basic setup for REST api - /:uid/up/:score? for now

Conflicts:

	lib/server/index.js
	src/server/index.coffee
This commit is contained in:
Tyler Renelle
2012-08-27 22:25:52 -04:00
parent b408cc4004
commit c8bbfda776
4 changed files with 33 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
module.exports = (expressApp) ->
expressApp.get '/:uid/up/:score?', (req, res) ->
score = parseInt(req.params.score) || 1
console.log {score:score}
model = req.getModel()
model.fetch "users.#{req.params.uid}", (err, user) ->
return if err || !user.get()
#TODO run this through scoring to account for weapons & armor, don't just +1
user.set('stats.exp', parseInt(user.get('stats.exp'))+score)
res.send(200)