A Koa v2 boilerplate for building restful API and view engine
- ES6/ES2015 support using Babel
- Use MongoDB for the database and Mongoose ODM for schema creation
- Use Bunyan for logging errors and events
- Use Nodemon for watching and restarting
- Use Nunjucks for rendering view
- Use Jest as test framework (TODO)
.
├── bin
│ └── server.js # entry of api server
├── src
│ │
│ ├── __test__ # testing scripts
│ ├── config # app configurations
│ ├── controllers # api implementations
│ ├── middlewares # middleware implementations
│ │ └── query_parser.js # mongoose connection service
│ ├── models # database schema definitions
│ ├── servies # standalone services
│ │ └── mongoose.js # mongoose connection service
│ ├── routes.js # router definitions
│ └── index.js # koa instance
└── package.json
$ npm install
$ npm run dev
Assign a fixed port
$ npm run dev -- --port 8080
$ npm run build
$ npm run start
Assign a fixed port
$ npm run build
$ npm run start -- -- --port 8080
$ npm test
MIT © Kenny-Chang