Simple starter kit for using KoaJS to build a web application written in ES7.
Just clone and explore it!
@controller('/sample')
export default class SampleController extends BaseController {
@get('/hello/:name')
async sayHello(ctx, next) {
ctx.body = `Hello ${ctx.params.name}`
}
@get('/goodbye')
async goodbye(ctx, next) {
ctx.status = HttpStatusCodes.OK
}
}
yarn start
Start your web application at localhost:3000
. You can also specify the port by PORT=8080 yarn start
.
yarn test
If you want to run the test suite. I use Jest for testing.
MIT