-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaching.js
More file actions
41 lines (37 loc) · 793 Bytes
/
Copy pathcaching.js
File metadata and controls
41 lines (37 loc) · 793 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
var Hapi = require('hapi'),
good = require('good');
// Create a server with a host and port
var server = Hapi.createServer('127.0.0.1', 8000, {
cache: 'redis'
});
// Add the route
server.route({
method: 'GET',
path: '/hello',
config:{
handler: function (req) {
req.reply('hello world');
},
cache: {
mode: 'client+server',
expiresIn: 60000
}
}
});
server.pack.require('good', {
subscribers: {
console: ['request', 'log', 'ops']
},
leakDetection: true,
extendedRequests: true
},
function (err){
if(err){
throw err;
}
}
);
// Start the server
server.start(function(){
server.log(['info'], 'server started...');
});