[TASK] Implement GET /user.

This commit is contained in:
Jan Philipp Timme 2013-09-16 22:01:52 +02:00
parent b6c968773b
commit 699f061281
1 changed files with 11 additions and 1 deletions

View File

@ -49,7 +49,17 @@ var constructor = function(db) {
}
if(req.method == "GET") {
res.send(200, JSON.stringify(req.session.data.user));
if(req.session.data.login == true) {
res.send(200, JSON.stringify({
"success": true,
"data": req.session.data.user
}));
} else {
res.send(200, JSON.stringify({
"success": false,
"error": "You are not logged in!"
}));
}
}
if(req.method == "POST") {