-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
46 lines (41 loc) · 915 Bytes
/
app.js
File metadata and controls
46 lines (41 loc) · 915 Bytes
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
var Path = require('path')
var Hapi = require('hapi')
// server
var server = new Hapi.Server()
server.connection({
port: process.env.PORT || 4000,
routes: {
files: {
relativeTo: Path.join(__dirname, 'public')
}
},
router: {
isCaseSensitive: false,
stripTrailingSlash: true
}
})
// register views
var baseDir = Path.join(__dirname, 'app/views')
var templateExt = 'dust'
server.views({
engines: {dust: require('hapi-dust')},
path: baseDir,
defaultExtension: templateExt,
isCached: false,
compileOptions: {
baseDir: baseDir,
defaultExt: templateExt,
}
})
// routes
server.route(require('./config/routes').routes)
// register plugins and start server
server.register(require('./config/plugins').plugins, function(err) {
if (err) {
throw err
}
// start server
server.start(function() {
console.info('Server started at ' + server.info.uri)
})
})