Skip to content

Instantly share code, notes, and snippets.

import Datastore from "@seald-io/nedb";
const dbfile = "collection.db"
const test = new Datastore({ filename: dbfile, autoload: true });
@develmts
develmts / apirouter.js
Last active November 22, 2016 16:23
Sample of mixing middleware
var router = require('koa-router')({prefix: '/api'}); // << important
router.get('/something', function *(next ){
this.body = yield getSomething()
});
router.get('/somewhere', function *(next ){
this.body = yield someWhere()
});