Skip to content

A Koa v2 boilerplate for building restful API and view engine.

Notifications You must be signed in to change notification settings

yo8568/koa-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koa-Boilerplate

A Koa v2 boilerplate for building restful API and view engine

Features

  • 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)

Structure

.
├── 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

Usage

Setup

$ npm install

Run Server for Development

$ npm run dev

Assign a fixed port

$ npm run dev -- --port 8080

Run for Production

$ npm run build
$ npm run start

Assign a fixed port

$ npm run build
$ npm run start -- -- --port 8080

Test

$ npm test

License

MIT © Kenny-Chang

About

A Koa v2 boilerplate for building restful API and view engine.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published