JSPM

  • Created
  • Published
  • Downloads 37
  • Score
    100M100P100Q63694F
  • License MIT

Simple and fast Restful API designed for horizontal scalability including cluster, based on Swagger, Nodejs, Redis + Passport, MongoDB, Express

Package Exports

  • nodetomic-api-swagger

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nodetomic-api-swagger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Nodetomic-api-swagger NPM version Build Status dependencies Status devDependencies Status Gitter chat GitHub license Downloads

Simple and fast Restful API designed for horizontal scalability including cluster, based on Swagger, Nodejs, Redis + Passport, MongoDB, Express

Examples

http://localhost:8000

http://localhost:8000/docs/

Example horizontal scalability

Technologies

Requirements

Installation

git clone https://github.com/kevoj/nodetomic-api-swagger
cd nodetomic-api-swagger
npm i

Features

  • Tokens

    • JWT merged with REDIS
  • Redis

    • Expiration of Key by role time
    • Encryption of information
    • Synchronization with user model update
    • Expiration and elimination event cleaner
  • Middleware

    • Login validation
    • Role validation
  • Authentication

    • local
    • facebook
    • twitter
    • google
    • github
    • bitbucket
  • Session

    • Single or Multiple
    • Get list of sessions
    • Destroy a session
  • Scalability

    • Support for simple execution (nodemon/node)
    • Support for cluster (Pm2)

Structure

  • client
  • src
    • api
      • controllers
      • models
      • swagger
    • assets
    • auth
      • controllers
      • passports
      • swagger
      • services
    • config
    • core
    • lib
    • seeds
    • views
    • app.js

Development

Start

npm start

Build

npm run build

  • Generate output folder: dist

    • dist
      • client
      • server
      • cluster.config.js (pm2 start cluster.config.js)
      • simple.config.js (pm2 start simple.config.js)
      • package.json
        • npm start
        • npm run pm2-simple
        • npm run pm2-cluster

Test

npm test

You must be aware of running npm start

Lint

npm lint

Preview compiled in mode simple (pm2)

npm run pm2-dev-simple

Preview compiled in mode cluster (pm2)

npm run pm2-dev-cluster

Production

Run mode Default (node)

npm run serve

Run mode simple (pm2)

npm run pm2-simple

Run mode cluster (pm2)

npm run pm2-cluster

License

MIT © Leonardo Rico