Skip to content

trawor/template-node-koa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

template-node-koa

NodeJS koa2 project template, start your koa in 5 secends!

ezgif com-gif-maker

Features

  • Muilt-CPU supports (cluster)
  • Simple color log (console override)
  • Add-to-use router(autoload files under 'router' folder)
  • Exception handle
  • Dockerfile within

Init

bash <(curl -sSL https://github.com/trawor/template-node-koa/raw/master/get.sh)

Start

Just add .js file to router/, like:

const router = require('koa-router')({
  prefix: 'api',
});

module.exports = router;

router.get('/test', async (ctx) => {
  ctx.body = {
    msg: 'ok',
  };
});