This commit is contained in:
Henry Oswald 2015-03-01 12:45:23 +00:00
commit 48badde67a
2 changed files with 22 additions and 1 deletions

View file

@ -0,0 +1,21 @@
request = require("request")
logger = require 'logger-sharelatex'
settings = require 'settings-sharelatex'
module.exports =
healthCheck: (req, res)->
opts =
url: "http://localhost:#{settings.internal.spelling.port}/user/#{settings.healthCheckUserId}/check"
json:
words:["helllo"]
language: "en"
request.post opts, (err, response, body)->
console.log body?.misspellings[0]?.suggestions.length
numberOfSuggestions = body?.misspellings[0]?.suggestions?.length
if numberOfSuggestions > 10
logger.log "health check passed"
res.send 200
else
logger.err body:body, numberOfSuggestions:numberOfSuggestions, "health check failed"
res.send 500

View file

@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/sharelatex/spelling-sharelatex.git"
},
"version": "0.1.0",
"version": "0.1.3",
"dependencies": {
"async": "0.1.22",
"express": "3.1.0",