From fed2338b0d95b6ea6516e0b4d52f673985ce3754 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Wed, 10 Aug 2016 19:39:08 -0300 Subject: [PATCH] express endpoint --- lib/expressapp.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/expressapp.js b/lib/expressapp.js index 508acfc..1c50e53 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -564,6 +564,24 @@ ExpressApp.prototype.start = function(opts, cb) { res.end(); }); + router.post('/v1/login/', function(req, res) { + getServerWithAuth(req, res, function(server) { + server.login({}, function(err, session) { + if (err) return returnError(err, res, req); + res.json(session); + }); + }); + }); + + router.post('/v1/logout/', function(req, res) { + getServerWithAuth(req, res, function(server) { + server.logout({}, function(err) { + if (err) return returnError(err, res, req); + res.end(); + }); + }); + }); + router.get('/v1/notifications/', function(req, res) { getServerWithAuth(req, res, { allowSession: true,