Skip to content

Instantly share code, notes, and snippets.

@dukedougal
Created November 8, 2015 02:37
Show Gist options
  • Save dukedougal/9edb1e4fd525271c57c0 to your computer and use it in GitHub Desktop.
Save dukedougal/9edb1e4fd525271c57c0 to your computer and use it in GitHub Desktop.
Simple restify-nedb example not working
var morgan = require('morgan')
var compression = require('compression')
var express = require('express');
var methodOverride = require('method-override')
var bodyParser = require('body-parser')
var app = express();
app.set('port', 1337);
app.use(compression());
app.use(methodOverride());
app.use(bodyParser());
app.use(morgan('combined'));
var server = require('http').createServer(app);
var restify = require('restify-nedb').mount;
var config = require('restify-nedb').config;
var path = require('path');
var Datastore = require('nedb');
var db = new Datastore();
// default config options
var opts = {
prefix: '/kernel'
};
// initialize our config object
cfg = new config(opts);
// if you aren't already using an nedb
// instance, then calling this will create
// one for you.
// accepts sync/blocking
// cfg.makeDataStore();
// api = new restify(cfg, app);
// or async <3
api = new restify(cfg, app);
server.listen(app.get('port'), function () {
console.log('restify-nedb example listening on %s', app.get('port'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment