Giter Club home page Giter Club logo

control-demo's Introduction

Control Demo

This is a simple real time todo app built with Node, Vue, and RethinkDB.

WebSockets

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.

Tokens

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.

Requirements

Install

This will install all third party dependencies required by the application.

npm install

Build

This will create all assets required by the application.

npm run build

Start Server

To run the database locally, first install RethinkDB on your machine, and run:

npm run start-db

To 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.pem

Once the database is running, you can start the web server. There are two environments to consider, development and production:

Production:
  • Uses pre-compiled assets (see Build) which must be available before running.
  • Uses UglifyJS to compress the bundled app code.
Development
  • 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-dev

You 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 show

It will look something like 192.168.1.xxx

HTTPS

HTTP/2 and SSL encryption are both disabled by default. To enable them, complete the following:

  1. Change ENABLE_SSL to true in .env
  2. Uncomment *-tls-key and *-tls-cert in rethinkdb.conf
  3. Run ./generate_keys.sh

You can check the response headers for HTTP/2 using cURL:

curl --head https://localhost:8000/ --cacert keys/cert.pem

Testing

npm test

Screenshots

Login Signup Dashboard

control-demo's People

Contributors

jabes avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.