Everything you need to start building a scalable web application.
Features
- ECMAScript 2015 (ES6) compatible.
- RESTful application interface.
- JSON API standard request/responses.
- ABAC (Attribute-Based Access Control)
- Database driver support.
- Session handling using cookies.
- Schema-based validation.
- Production process manager.
Dependencies
Installation
Clone the repository, or download the latest release.
$ git clone https://github.com/nuxy/nodejs-restful-jsonapi-seed.git
Install package dependencies using NPM.
$ npm install
Developers
CLI options
Set your environment. If NODE_ENV
is not defined, the default config development
is used.
$ export NODE_ENV=<production|staging|qa>
Compile sources (using Babel) to a distribution:
$ npm run build
Launch a single server with compiled distribution:
$ npm run start
Launch a server cluster with compiled distribution:
$ npm run deploy
Launch the server (development mode) with nodemon:
$ npm run watch
Run ESLint on project sources:
$ npm run lint
Run Mocha integration tests:
$ npm run test
Generate documentation using ESDoc:
$ npm run doc
Examples
The following routes have been enabled in the application. Please refer to each file for implementation details.
Login
Basic example of how to authenticate using a POST
request.
$ curl -X POST -H 'Content-Type: application/vnd.api+json' -i http://localhost:3000/login --data '{"username": "foo", "password": "bar"}'
Basic example of how to check session status using a GET
request.
$ curl -X GET -H 'Content-Type: application/vnd.api+json' -i http://localhost:3000/login
User
Common use case that supports GET
, PATCH
, POST
, PUT
, and DELETE
methods.
$ curl -X GET -H 'Content-Type: application/vnd.api+json' -i http://localhost:3000/user
Documentation
When the server is running in development mode generated documentation can be accessed at: http://localhost:3000/doc
Contributions
If you fix a bug, or have a code you want to contribute, please send a pull-request with your changes. (Note: Before committing your code please ensure that you are following the Node.js style guide)
License and Warranty
This package is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
nodejs-restful-jsonapi-seed is provided under the terms of the MIT license