-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
41 lines (31 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*jshint devel: true, node: true, bitwise: false, camelcase: true, curly: true,
eqeqeq: true, forin: true, freeze: true, immed: true, newcap: true,
noarg: true, noempty: true, nonbsp: false, nonew: true, plusplus: true,
quotmark: single, undef: true, unused: vars, strict: true, trailing: true,
white: true, onevar: true, indent: 2, maxparams: 3, maxdepth: 3, maxlen: 80 */
'use strict';
var Hapi = require('hapi');
var Good = require('good');
var server = new Hapi.Server('localhost', 8000);
var routes = require('./routes');
var Mongoose = require('mongoose');
// MongoDB Connection
Mongoose.connect('mongodb://127.0.0.1/incidentreports');
var rootHandler = function (request, reply) {
reply({ message: "Welcome to City of Virginia Beach's Incidents Results API" });
};
// Set the root route
server.route({
method: 'GET',
path: '/',
handler: rootHandler
});
routes.init(server);
server.pack.register(Good, function (err) {
if (err) {
throw err;
}
server.start(function () {
server.log('info', 'Server running at: ' + server.info.uri);
});
});