👏 A simple boilerplate for writing small Koa web services
$ git clone https://github.com/aandrewww/koa2-simple-ws-boiler your-project-name
$ cd your-project-name
$ rm -rf .git && git init
$ npm install
$ npm start
npm run
scripts.axios
for Promise based requests.bluebird
featured promise library.eslint
as JavaScript linter.prettier
code formatting, configured to work witheslint
out of the box.husky
for git hooks.koa-bodyparser
for parsing request bodies.koa-helmet
adds important security headers.koa-validate
validate request params and format request params.koa2-cors
CORS middleware for cross-domain requests.koa-respond
for helper functions on the context.dotenv
for environment variable management.log4js
for logging.lodash
utility library.mongoose
as elegant mongodb object modeling for node.js.yargs
helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
There are a few defined run scripts, here's a list of them with a description of what they do. To run them, simply execute npm run <script name>
- e.g. npm run lint
start
: Used for simple start app.test
: Runs tests (NOT SUPPORTED).lint
: Lints
Rename (or copy and rename) .env.default into .env
cp .env.default .env
The environment variables can be reached via dotenv package.
require('dotenv').config({ path: path.join(__dirname, '/.env') });
There're some features (updates) which will be included in this starter in the near future:
- Add route for '/'.
- Add directory structure into Readme.
- Add simple model.
- Add eslint description
- Add tests
- Add coverage for tests
- Add support clasterization
- Add koa-compress
- Add npm run ngrok (?)
MIT.