Skip to content

Instantly share code, notes, and snippets.

/project-state.md Secret

Created Mar 7, 2018
Embed
What would you like to do?

Tree

-- src
| -- app.ts
| -- server.ts
-- package.json

app.ts

import Koa from 'koa';
import Router from 'koa-router';

const app = new Koa();
const router = new Router();

router.get('/', (ctx: Koa.Context) => {
    ctx.body = 'Hello World';
});

app.use(router.routes());

export = app;

server.ts

import app from './app';

const port = process.env.PORT || 3000;
const server = app.listen(port);
console.info(`Listening to http://localhost:${port} 🚀`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment