all repos — archive/homestead @ 1d8c3484540f2bf5fa70eed2485df0b03efafa5b

My future indieweb platform

feat: setup basic web server

Alan Pearce
commit

1d8c3484540f2bf5fa70eed2485df0b03efafa5b

parent

6815f5e27a18eddad8862a6e8fbac1c7e2fefcd7

1 file changed, 25 insertions(+), 0 deletions(-)

changed files
M src/index.jssrc/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}`) + }) +}