forked from Miantang/IoT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
32 lines (31 loc) · 976 Bytes
/
routes.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
var Device = require('./controllers/device');
var User = require('./controllers/user');
var Ip = require('./controllers/ip');
module.exports = function(app) {
// pre handle user
//app.use(function(req, res, next) {
// var _user = req.session.user;
//
// app.locals.user = _user;
//
// next();
//});
app.get('/', function(req, res) {
console.log('user in session: ', req.session.user);
res.render('index');
});
// Device
app.get('/devices', Device.getAllDevices);
app.get('/devices/:id', Device.getDevice);
app.post('/devices/:id', Device.updateDevice);
app.get('/devices/:id/value', Device.getDeviceValue);
// User
app.get('/user', User.getUser);
app.post('/user', User.postUser);
app.post('/user/signup', User.signup);
app.post('/user/login', User.login);
// ip
app.get('/ip', Ip.getAllIp);
app.post('/ip', Ip.setIp);
app.post('/camip', Ip.setCamIp);
};