Skip to content

Commit

Permalink
[#36] Adding 'createSessionFromTeacherApp()' to display the session i…
Browse files Browse the repository at this point in the history
…d in the console
  • Loading branch information
chrqls committed Nov 14, 2013
1 parent d795eb2 commit 617d89b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
22 changes: 21 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,26 @@ exports.handlePushMessage = function(req, res) {
}
};

/**
Creating a session with teacher name, session title, and group name
**/
exports.createSessionFromTeacherApp = function(req, res) {

try {

console.log('\n## JSON from "createSessionFromTeacherApp" ##');
console.log('\t>>> '+req.body);
console.log('\t>>> '+req.body.teacherName);
console.log('\t>>> '+req.body.sessionName);
console.log('\t>>> '+req.body.groupName+'\n');

} catch (e) {
res.handleError("Can't parse Incoming JSON in createSessionFromTeacherApp method");
}

return res.sendText(HTTP_STATUS_OK, OK);
};

exports.handlePushMsgPost = function(req, res) {
var message = req.body.MSG;
try {
Expand Down Expand Up @@ -812,4 +832,4 @@ exports.handleEchoClientIP = function(req, res) {
return res.sendJSON(HTTP_STATUS_OK, {
'ip' : clientip
});
};
};
7 changes: 7 additions & 0 deletions smileplug.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ js.get('/smile/metadata/rating', routes.handleRatingMetadataGet);

js.put('/smile/question', routes.handlePushMessage);
js.post('/smile/question', routes.handlePushMessage);

/**
Create a session from smile_teacher_android app
**/
js.put('/smile/createsession', routes.createSessionFromTeacherApp);
js.post('/smile/createsession', routes.createSessionFromTeacherApp);

/**
Get the questions from existing from existin session
@method /smile/question
Expand Down

0 comments on commit 617d89b

Please sign in to comment.