Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created October 4, 2018 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amandeepmittal/afbbdbed1015f1649ecd74c4dcae2c71 to your computer and use it in GitHub Desktop.
Save amandeepmittal/afbbdbed1015f1649ecd74c4dcae2c71 to your computer and use it in GitHub Desktop.
// app.js
const Koa = require('koa');
const koaBody = require('koa-body');
const app = new Koa();
// Set up body parsing middleware
app.use(koaBody());
// Require the Router we defined in books.js
let books = require('./books.js');
// Use the Router on the sub route /books
app.use(books.routes());
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment