mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge branch 'master' of https://github.com/sharelatex/spelling-sharelatex
This commit is contained in:
commit
48badde67a
2 changed files with 22 additions and 1 deletions
21
services/spelling/app/coffee/HealthCheckController.coffee
Normal file
21
services/spelling/app/coffee/HealthCheckController.coffee
Normal 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
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue