galaxy-api/index.js

26 строки
554 B
JavaScript
Исходник Обычный вид История

var settings = require('./settings');
2014-08-06 07:35:25 +04:00
2014-12-11 02:16:36 +03:00
var Hapi = require('hapi');
var routes = require('./api/routes');
2014-08-06 07:35:25 +04:00
2014-12-11 02:16:36 +03:00
var server = new Hapi.Server();
server.connection({host: settings.HOST, port: settings.PORT});
routes(server);
2014-08-06 07:35:25 +04:00
2014-12-11 02:16:36 +03:00
server.start(function () {
console.log('Listening on %s', server.info.uri);
});
server.register({
register: require('hapi-node-postgres'),
options: {
connectionString: settings.POSTGRES_URL
}
}, function (err) {
if (err) {
console.error('Failed to load "hapi-node-postgres" plugin: %s', err);
throw err;
}
});