A Node.js service template generator for Yeoman based on hapi
Choose your tech stack and create node.js template of api service
- Rethinkdb with RethinkDbDash as a node.js driver
- MongoDB with mongoose as a node.js driver
- handlebars - Handlebars provides the power necessary to let you build semantic templates effectively with no frustration.
- Hapi.js - A rich framework for building applications and services
- bluebird - Bluebird is a fully featured promise library with focus on innovative features and performance
- boom - HTTP-friendly error objects
- config - Node-config organizes hierarchical configurations for your app deployments.
- hapi-swagger - Auto swagger documentations generator
- joi - Object schema description language and validator for JavaScript objects
- lodash - A modern JavaScript utility library delivering modularity, performance & extras.
- winston - A multi-transport async logging library for node.js
- pm2 - Production process manager for Node.js apps with a built-in load balancer
- jasmine - A multi-transport async logging library for node.js
- istanbul - A JS code coverage tool written in JS
- sinon - Standalone test spies, stubs and mocks for JavaScript
The output service template supported Node.js v4+.
Make sure you have yo installed
npm install -g yo
Install the generator globally
npm install -g generator-node-template
Run: generator-node-template and choose your preferences
yo node-template
.
├── config
│ ├── idefault.json
│ ├── development.json
│ ├── prod.json
├── lib
│ ├── server.js
│ └── data
│ └── api
│ └── └── models
│ └── ├── productsEndpoints.js
│ └── ... // more endpoints
│ └── infrastructure
│ └── └── hapi
│ └── └── ├── authenticationPlugin.js
│ └── └── ├── extentions.js
│ └── ├── logger.js
│ └── logic
│ └── ├── productsHandler.js
│ └── ├── authentication.js
├── templates
├── public
├── tests
│ └── integrations
│ └── units
├── index.js
├── package.json
└── readme.md
index.js file expose all db models and initialize them
contains all logics code for the endpoints
contains all api models and endpoints defenitions
contains infrastructure code (e.g: logger)
authentications.js contains authenticate function which will be called with the token value for each request
contains all integration tests
contains all unit tests
- How to run tests
npm test
- How to run lint
npm lint
- How to run the service
npm start
- How to run the service using pm2
pm2 start ecosystem.json --env={env_name}
- How to work with several environment with config module
Want to contribute? Great! Clone the repository and push your changes
Run the following command on the root project
npm link
Then every time when you run the install command it will take it from your local source code
- Add support of new databases
- Add tests for the generator
- Add support of new Lints
MIT