You'll need Node.js >= 6 and npm
.
To start, clone this repo, cd
to its directory and run npm install
. All operations can be done through npm
commands. Here's a handy guide:
npm start
will start the app in port 3000.npm t
will run unit tests.npm run lint
will check code stylenpm run doc
will show API spec
This is a standard express
application. src/index.js
is a good place to start and follow the require
s. Here's a guide to set what you might expect of each directory.
app.js
- App entry point. Mounts routes and middlewares into theexpress
instance, as long as injects it real-time features.routes
- Contains the routes handlers. Database access can be made here, but for complex business cases, functions fromcontrollers
are invoked.controllers
- Contains complex business logic. Can access database.db
- Database access. An API is provided to perform atomic operations. The implementation uses the Strategy pattern in order to furtherly plug other database clients without changing the API exposed to routes and controllers.
Operations that makes modifications to the data are published through a WebSockets interface. Use a socket.io
client in your frontend app in order to get instantly notified.