mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
27 lines
934 B
CoffeeScript
27 lines
934 B
CoffeeScript
|
Settings = require 'settings-sharelatex'
|
||
|
logger = require 'logger-sharelatex'
|
||
|
logger.initialize("spelling-sharelatex")
|
||
|
SpellingAPIController = require './app/js/SpellingAPIController'
|
||
|
restify = require 'restify'
|
||
|
Path = require("path")
|
||
|
metrics = require("metrics-sharelatex")
|
||
|
metrics.initialize("tpds")
|
||
|
metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
|
||
|
|
||
|
server = restify.createServer
|
||
|
name: "spelling-sharelatex",
|
||
|
version: "0.0.1"
|
||
|
|
||
|
server.use restify.bodyParser(mapParams: false)
|
||
|
server.use metrics.http.monitor(logger)
|
||
|
|
||
|
server.post "/user/:user_id/check", SpellingAPIController.check
|
||
|
server.post "/user/:user_id/learn", SpellingAPIController.learn
|
||
|
server.get "/status", (req, res)->
|
||
|
res.send(status:'spelling api is up')
|
||
|
|
||
|
host = Settings.host || "localhost"
|
||
|
port = Settings.port || 3005
|
||
|
server.listen port, host, () ->
|
||
|
console.log "#{server.name} listening at #{host}:#{port}"
|