7. "express": "^4.12.3"
(function() {
'use strict';
var express = require('express');
var app = express();
app.set('json spaces', 2);
....
var server = app.listen(3003, function() {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
}());
8. "hapi": "^8.4.0"
var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({port: 3001});
....
// Start the server
server.start(function() {
console.log('Server running at:', server.info.uri);
});
9. "koa": "^0.20.0"
"use strict";
var koa = require('koa');
var route = require('koa-route');
var app = koa();
require('koa-qs')(app);
....
app.listen(3000);
14. Testing
• Dredd
var hooks = require('hooks');
var before = hooks.before;
hooks.beforeEach(function(transaction) {
if (transaction.expected.headers['Content-Type'] == 'application/json') {
transaction.expected.headers['Content-Type'] = 'application/json; charset=utf-8';
}
});
15. Github repository of project:
https://github.com/abtris/nodeschool-hk-2015-05-23
Ideas how project improve:
• you can fork and contribute
• you can try add 404, 500 pages
• you can try persistent layer using Redis