add getDic

This commit is contained in:
Henry Oswald 2019-01-02 14:46:44 +00:00
parent de051ceebc
commit a4eda59189
3 changed files with 10 additions and 0 deletions

View file

@ -20,6 +20,7 @@ server.use bodyParser.json(limit: "2mb")
server.use metrics.http.monitor(logger)
server.del "/user/:user_id", SpellingAPIController.deleteDic
server.get "/user/:user_id", SpellingAPIController.getDic
server.post "/user/:user_id/check", SpellingAPIController.check
server.post "/user/:user_id/learn", SpellingAPIController.learn
server.get "/status", (req, res)->

View file

@ -27,3 +27,9 @@ module.exports = SpellingAPIController =
return next(error) if error?
res.sendStatus(204)
getDic: (req, res, next)->
logger.info token: req?.params?.user_id, "getting user dictionary"
SpellingAPIManager.getDic req.params.user_id, (error, words)->
return next(error) if error?
res.send(words)

View file

@ -49,3 +49,6 @@ module.exports = SpellingAPIManager =
deleteDic: (token, callback)->
LearnedWordsManager.deleteUsersLearnedWords token, callback
getDic: (token, callback)->
LearnedWordsManager.getLearnedWords token, callback