This is a simple real time todo app built with Node, Vue, and RethinkDB.
The nes plugin is used to push real time updates to the browser. Reminders and user sessions are synced with the use of subscriptions to listen for events, and publish to emit events.
The JWT plugin is used to sign authentication tokens that are passed to and stored on the client on login. The tokens are unique to each user and are required by the server for API calls using the Authorization header.
This will install all third party dependencies required by the application.
npm installThis will create all assets required by the application.
npm run buildTo run the database locally, first install RethinkDB on your machine, and run:
npm run start-dbTo run the database on a cloud service such as compose.io,
make sure all RETHINK_* environment variables are defined.
Example:
RETHINK_HOST=aws-us-west-2-portal.2.dblayer.com
RETHINK_PORT=16647
RETHINK_DB=control_demo
RETHINK_SSL_CERT={BASE64_ENCODED_SSL_CERTIFICATE}
RETHINK_USER=admin
RETHINK_PASSWORD={DEPLOYMENT_PASSWORD}If using SSL, RETHINK_SSL_CERT must be a base64 encoded string, which you can obtain with the following command:
base64 --wrap 0 keys/cert.pemOnce the database is running, you can start the web server.
There are two environments to consider, development and production:
- Uses pre-compiled assets (see Build) which must be available before running.
- Uses UglifyJS to compress the bundled app code.
- Uses webpack middleware to compile assets on demand.
- Uses nodemon to auto-reload the server when changes are made to server modules
# production
npm start
# development
npm run start-devYou can now access the app on the localhost domain.
The server will also bind to all available addresses, so if you wish to access the app across a network, use the local ip address of the machine running the server.
ip addr showIt will look something like 192.168.1.xxx
HTTP/2 and SSL encryption are both disabled by default. To enable them, complete the following:
- Change
ENABLE_SSLtotruein.env - Uncomment
*-tls-keyand*-tls-certinrethinkdb.conf - Run
./generate_keys.sh
You can check the response headers for HTTP/2 using cURL:
curl --head https://localhost:8000/ --cacert keys/cert.pemnpm test

