diff --git a/services/spelling/app.coffee b/services/spelling/app.coffee index 16a7dc9309..8894296083 100644 --- a/services/spelling/app.coffee +++ b/services/spelling/app.coffee @@ -2,19 +2,18 @@ Settings = require 'settings-sharelatex' logger = require 'logger-sharelatex' logger.initialize("spelling-sharelatex") SpellingAPIController = require './app/js/SpellingAPIController' -restify = require 'restify' +express = require('express') Path = require("path") +server = express() +bodyParser = require('body-parser') metrics = require("metrics-sharelatex") metrics.initialize("spelling") metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger) HealthCheckController = require("./app/js/HealthCheckController") -server = restify.createServer - name: "spelling-sharelatex", - version: "0.0.1" -server.use restify.bodyParser(mapParams: false) +server.use bodyParser.json() server.use metrics.http.monitor(logger) server.post "/user/:user_id/check", SpellingAPIController.check diff --git a/services/spelling/app/coffee/Metrics.coffee b/services/spelling/app/coffee/Metrics.coffee deleted file mode 100644 index 10d00aa11d..0000000000 --- a/services/spelling/app/coffee/Metrics.coffee +++ /dev/null @@ -1,23 +0,0 @@ -StatsD = require('node-statsd').StatsD -statsd = new StatsD('localhost',8125) - -buildKey = (key)-> "spelling.#{process.env.NODE_ENV}.#{key}" - -module.exports = - inc : (key, sampleRate)-> - statsd.increment buildKey(key, sampleRate) - - Timer : class - constructor :(key)-> - this.start = new Date() - this.key = buildKey(key) - done:-> - timeSpan = new Date - this.start - statsd.timing("#{this.key}-time", timeSpan) - statsd.increment "#{this.key}-count" - - gauge : (key, value, sampleRate)-> - stats = {}; - stat = buildKey(key) - stats[stat] = value+"|g"; - statsd.send(stats, sampleRate); diff --git a/services/spelling/app/coffee/SpellingAPIController.coffee b/services/spelling/app/coffee/SpellingAPIController.coffee index e98d9736d8..9a7e4fa8d2 100644 --- a/services/spelling/app/coffee/SpellingAPIController.coffee +++ b/services/spelling/app/coffee/SpellingAPIController.coffee @@ -1,7 +1,7 @@ SpellingAPIManager = require './SpellingAPIManager' restify = require 'restify' logger = require 'logger-sharelatex' -metrics = require('./Metrics') +metrics = require('metrics-sharelatex') module.exports = SpellingAPIController = check: (req, res, next) -> diff --git a/services/spelling/package.json b/services/spelling/package.json index 28b55cdcff..9aed24c162 100644 --- a/services/spelling/package.json +++ b/services/spelling/package.json @@ -9,14 +9,14 @@ "version": "0.1.3", "dependencies": { "async": "0.1.22", - "express": "3.1.0", + "body-parser": "^1.12.0", + "express": "^4.12.1", "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.0.0", "metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.0.0", "mongojs": "0.9.11", "node-statsd": "0.0.3", "redis": "~0.8.4", "request": "^2.53.0", - "restify": "2.5.1", "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0", "underscore": "1.4.4", "v8-profiler": "^5.2.4"