mirror of
https://github.com/arnaucube/thoughts.git
synced 2026-02-06 19:26:47 +01:00
web i server: login, post thought, get thoughts
This commit is contained in:
@@ -54,7 +54,8 @@ exports.addThought = function(req, res) {
|
||||
var thought = new thoughtModel({
|
||||
time: req.body.time,
|
||||
content: req.body.content,
|
||||
user_id: req.body.user_id
|
||||
username: req.body.username,
|
||||
avatar: req.body.avatar
|
||||
});
|
||||
|
||||
thought.save(function(err, thought) {
|
||||
|
||||
@@ -59,7 +59,7 @@ exports.addUser = function(req, res) {
|
||||
username: req.body.username,
|
||||
password: req.body.password,
|
||||
description: req.body.description,
|
||||
icon: req.body.icon,
|
||||
avatar: req.body.avatar,
|
||||
mail: req.body.mail,
|
||||
admin: req.body.admin
|
||||
});
|
||||
@@ -124,12 +124,13 @@ exports.login = function(req, res) {
|
||||
//expiresInMinutes: 1440 // expires in 24 hours
|
||||
expiresIn: '60m'
|
||||
});
|
||||
|
||||
console.log(user);
|
||||
// return the information including token as JSON
|
||||
res.json({
|
||||
success: true,
|
||||
message: 'Enjoy your token!',
|
||||
token: token
|
||||
token: token,
|
||||
avatar: user.avatar
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user