-
Notifications
You must be signed in to change notification settings - Fork 0
/
pltz.js
50 lines (41 loc) · 1.14 KB
/
pltz.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
48
49
50
// Fake user database
var pltz = [
{ name: 'Home in 5', template: '[email protected]?subject=Home%20in%205&body=Lvoe' },
{ name: 'Running Late', template: '[email protected]?subject=Running%20late&body=Lvoe' }
];
exports.list = function(req, res){
res.render('index', { title: 'empltz', pltz: pltz });
};
// exports.load = function(req, res, next){
// var id = req.params.id;
// req.plt = pltz[id];
// if (typeof(id) === 'number') {
// req.plt.id = id;
// console.log('HELLO HERE IS THIS THING'+ req.plt.id);
// }
// if (req.plt) {
// next();
// } else {
// next(new Error('cannot find user ' + id));
// }
// };
exports.edit = function(req, res){
res.render('edit', {
title: 'Editing user ',
plt: req.plt
});
};
// exports.view = function(req, res){
// res.render('users/view', {
// title: 'Viewing user ' + req.user.name
// , user: req.user
// });
// };
//
exports.update = function(req, res){
var plt = req.body.plt;
console.log(req.plt)
req.plt.name = plt.name;
req.plt.template = plt.template;
res.redirect('back');
};