-
Notifications
You must be signed in to change notification settings - Fork 25
/
app.js
47 lines (36 loc) · 1.17 KB
/
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
46
47
var config = require(__dirname + '/config/config.js');
var express = require('express');
var swig = require('swig');
var app = express();
app.use(express.json());
app.use(express.urlencoded());
app.use(express.cookieParser());
app.use(express.session({secret: config.cookieSecret}));
app.use(app.router);
// Static
app.use(express.static(__dirname + '/publish'));
// Engine
app.engine('html', swig.renderFile);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
// Controllers
var user = require(__dirname + '/controllers/login.js');
user.doLoginCtrl(app);
var remoteCamera = require(__dirname + '/controllers/camera.js');
remoteCamera.cameraCtrl(app);
var photos = require(__dirname + '/controllers/watch.js');
photos.watchPhotosCtrl(app);
// Routes
var webapp = require(__dirname + '/routes/all.js');
webapp.createRoutes(app);
// Helper
var address = require(__dirname + '/controllers/ipHelper.js');
address.ipHelperCtrl(app);
// System
var os = require(__dirname + '/controllers/system.js');
os.systemCtrl(app);
exports.server = function() {
return app;
}
app.listen(config.port);
console.log("[info] Server started and listening on port " + config.port);