This repository contains an example of using both the remotestorage HTTP APIs directly as well as abstracted with the remoteStorage.js library; both, against the armadietto remoteStorage server.
In a terminal:
$ cd $ARMADIETTO_REPO/example
$ npm install
Where $ARMADIETTO_REPO is the root where you synced the armadietto repo.
To run the example server:
$ npm run start
The armadietto server starts on port 8000.
Leave the terminal running the server as is.
In a new terminal host the example application:
$ npm run serve
The example application is now available on port 8080.
Now open the example app. You may need to dismiss browser
warnings about the self-signed certificate for localhost
before the clients
will connect properly.
open http://localhost:8080
Please read the text in the lower-right pane of the application.
The same text is available here: ignore/welcome.txt.
The example app shows the remotestorage-widget integration.
The easiest way to create a user is to use the widget. To create user 'tester' click the widget and enter:
tester@localhost:8000
Click Connect
. You'll be taken to an on-boarding site served by your localhost armadietto.
Click Sign Up
in upper right corner.
There is no automated redirection back to the example application at this point, reload it:
open http://localhost:8080
First we need to fill out some configuration fields in the app.
For server put in http://localhost:8000
.
For user type in the user's name, e.g. tester
.
Click run getWebFinger() in GET /.well-known/webfinger use-case. The remotestorageHref field should be filled in.
All fields should now be filled in the GOTO authDialogUrl (and redirect back) use-case.
Click run gotoAuth() to go to the armadietto server's onboarding/login page.
Click Sign Up
in upper right corner.
There is no automated redirection back to the example application at this point, reload it:
open http://localhost:8080
Once a user is setup (above) a login involves the same steps as creating a user (above) except the password is entered when asked for, instead of clicking on Sign Up
.
You're logged in when all the fields including a token are filled in at the top of the app:
- server
- user
- token
- scope
Note that going through the login flow will redirect you back to the app with the token filled in.
Use remotestorage HTTP APIs Directly
Ensure you're logged in: either through widget or manually.
To work with data using remotestorage HTTP APIs go to the DATA over HTTP * /storage use-case.
Everything will be done with this use-case.
Click on the use-case title to expand instructions.
Play around with the values and observe the log (top-right pane). Click on interesting log traces to go to the source code (bottom-right pane).
Use remoteStorage.js
Ensure you're logged in: either through widget or manually.
To work with data using remoteStorage.js go to the DATA over remoteStorage.js use-case.
Everything will be done with this use-case.
Click on the use-case title to expand instructions.
Play around with the values and observe the log (top-right pane). Click on interesting log traces to go to the source code (bottom-right pane).