diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js index e69de29..9ba74de 100644 --- a/src/index.js +++ b/src/index.js @@ -0,0 +1,25 @@ +'use strict' + +const PORT = process.env.PORT || 3000 + +const Koa = require('koa') +const app = new Koa() + +const Router = require('koa-router') +const router = new Router() + +router.get('/', function (ctx, next) { + ctx.status = 200 + ctx.body = 'hello world' + next() +}) + +app.use(router.routes()).use(router.allowedMethods()) + +module.exports = app + +if (require.main === module) { + app.listen(PORT, () => { + console.log(`App listening on port ${PORT}`) + }) +} |