-
Notifications
You must be signed in to change notification settings - Fork 57
/
index.js
48 lines (41 loc) · 876 Bytes
/
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
42
43
44
45
46
47
var Hapi = require('hapi');
var FalcorHandler = require('falcor-hapi');
var falcorRouterDemoFactory = require('falcor-router-demo');
var app = new Hapi.Server();
app.connection({
host: "localhost",
port: 9090
});
// serve static files (index.html)
var plugins = [
{
register: require('inert')
},
{
register: require('bassmaster')
}
];
app.register(plugins, function (err) {
if (err) {
throw err;
}
app.route({
method: "GET",
path: "/{param*}",
handler: {
directory: {
path: __dirname
}
}
});
});
app.route({
method: ["GET", "POST"],
path: "/model.json",
handler: FalcorHandler.dataSourceRoute(function(req, res) {
return falcorRouterDemoFactory("1");
})
});
app.start(function () {
console.log("Navigate to:", app.info.uri);
});