forked from bazilio91/zabbix-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
45 lines (33 loc) · 911 Bytes
/
app.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
var app = require('koa')();
var logger = require('koa-logger');
var route = require('koa-route');
var views = require('koa-views');
var serve = require('koa-static');
var ZabbixProxy = require('./lib/zabbix');
var config = require('./config');
app.use(views('views', {
default: 'jade',
cache: true
// map: {
// html: underscore
// }
}));
app.use(logger());
app.use(route.get('/', index));
app.use(route.get('/host/:id', index));
function *index() {
this.locals.title = 'monitoring';
yield this.render('index', {
user: 'Prick'
});
}
// Send static files
app.use(serve('./public'));
// This must come after last app.use()
var server = require('http').Server(app.callback()),
io = require('socket.io')(server),
zabbix = new ZabbixProxy(config, io);
zabbix.start();
// Start the server
server.listen(1337);
console.info('Now running on localhost:1337');