joyent-portal/spikes/leak/src/server/index.js

31 lines
601 B
JavaScript
Raw Normal View History

const epimetheus = require('epimetheus');
2016-11-21 15:18:12 +02:00
const requireDir = require('require-dir');
const plugins = require('./plugins');
const routes = requireDir('./routes');
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({
host: '0.0.0.0',
2016-11-21 15:18:12 +02:00
port: 8000
});
server.register(plugins, (err) => {
if (err) {
throw err;
}
Object.keys(routes).forEach((name) => {
routes[name](server);
});
epimetheus.instrument(server);
2016-11-21 15:18:12 +02:00
server.start((err) => {
server.connections.forEach((conn) => {
console.log(`started at: ${conn.info.uri}`);
});
});
});