Skip to content

Instantly share code, notes, and snippets.

@SergProduction
Created June 7, 2017 13:49
Show Gist options
  • Save SergProduction/3749501a9fff218e49ad609025f6bae1 to your computer and use it in GitHub Desktop.
Save SergProduction/3749501a9fff218e49ad609025f6bae1 to your computer and use it in GitHub Desktop.
const Koa = require('koa');
const app = new Koa();
const router = require('koa-router')();
router.get('/', async (ctx, next) {
const result = await new Promise( resolve => {
setTimeout(() => {resolve('YES!!!') }, 500)
})
ctx.body = result
});
app.use(routes.routes());
app.use(routes.allowedMethods());
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment