1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

move accessTokens endpoint from app unit to api unit

This commit is contained in:
Vishal Banthia 2015-12-02 23:13:46 +09:00
parent 5729095acb
commit 0ec03aa2c0
4 changed files with 57 additions and 24 deletions

View file

@ -124,29 +124,6 @@ module.exports = function(options) {
res.send('var GLOBAL_APPSTATE = ' + JSON.stringify(state))
})
app.get('/app/api/v1/accessTokens', function(req, res) {
dbapi.loadAccessTokens(req.user.email)
.then(function(cursor) {
return Promise.promisify(cursor.toArray, cursor)()
.then(function(list) {
var titles = []
list.forEach(function(token) {
titles.push(token.title)
})
res.json({
success: true
, titles: titles
})
})
})
.catch(function(err) {
log.error('Failed to load tokens: ', err.stack)
res.json(500, {
success: false
})
})
})
server.listen(options.port)
log.info('Listening on port %d', options.port)
}