generator-api-ecma6 v0.0.5
generator-api-ecma6
Restify api with unit and integrated tests written in ecma6
Folder structure
.
├── src
| ├── app
| ├── core
| ├── features
| | ├── {version}
| | | ├── {domain}
| | | | ├── controllers
| | | | ├── repositories
| | | | ├── routes
| | | | ├── services
| ├── router
| ├── util
├── test
| ├── integration
| └── unitapp
Folder with server implementation
core
Folder with objects to be extendeds
features
Folder with your domains
- version - api version
- domain
- controllers - controllers (control the request and response flow) to be used in routes
- services - services (business logic) to be used in controllers
- repositories - repositories (bring data) to be used in services
- routes - routes (only call controller method) to be exported to index.js file
- domain
router
Route consolidator
util
Folder with helpers
Installation
First, install Yeoman and generator-api-ecma6 using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-api-ecma6Then generate your new project:
yo api-ecma6Features
Including
.gitignore.eslintrc(airbnb).npmignore.codeclimate.yml.travis.yml.editorconfig- nodemon
- git-pre-push (run test)
- git-pre-commit (run lint)
- git-post-commit (run git status)
Usage
Scripts
Development
npm run devrun nodemon src/index
npm run dev:testsrun nodemon and tests
Coverage
npm run coveragerun istanbul coverage and put result in
coverage/Code Climate
npm run climate-coveragerun coverage and send it to code-climate (you need to set CODECLIMATE_REPO_TOKEN as an enviroment variable)
Code Climate dotenv
npm run climate-coverage-dotenvrun coverage and send it to code-climate (you need to set CODECLIMATE_REPO_TOKEN in .env file)
Start
npm startrun
node src/index.jsDependencies Vulnerabilities
npm run check-dependenciescheck dependencies vulnerabilities using nsp
Post install
npm run postinstallcall check-dependencies, this is will be called after every package installation
Linter
npm run lintrun
eslint srcaccording.eslintrcfileTests
Unit
npm run test:unitrun
mocha --opts test/mocha.opts test/unitIntegration
npm run test:integrationrun
mocha --opts test/mocha.opts test/integrationAll
npm testrun
mocha
License
MIT ©