express-api-common
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -35,2 +35,6 @@ 'use strict'; | ||
var _expressPromBundle = require('express-prom-bundle'); | ||
var _expressPromBundle2 = _interopRequireDefault(_expressPromBundle); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -43,3 +47,12 @@ | ||
const { logger, notFoundHandler } = options; | ||
const metricsMiddleware = (0, _expressPromBundle2.default)({ includeMethod: true }); | ||
log('setting up health check endpoint at /_health'); | ||
_expressServer2.default.use('/_health', _health2.default); | ||
// we do not want to include healthcheck in metrics | ||
// so use the metrics middleware below health | ||
log('setting up prometheus metrics at /metrics'); | ||
_expressServer2.default.use(metricsMiddleware); | ||
log('using middleware - logRequests and bodyParser'); | ||
@@ -50,12 +63,10 @@ _expressServer2.default.use((0, _logRequests2.default)(logger)); | ||
log('setting up health check endpoint at /_health'); | ||
_expressServer2.default.use('/_health', _health2.default); | ||
log('setting up error handler'); | ||
_expressServer2.default.use((0, _getErrorHandler2.default)(process.env.NODE_ENV)); | ||
_expressServer2.default.startServer = (port, onListen) => { | ||
_expressServer2.default.start = _expressServer2.default.startServer = (port, onListen) => { | ||
_expressServer2.default.use(notFoundHandler || _handleNotFound2.default); | ||
_expressServer2.default.listen(port, onListen); | ||
}; | ||
return _expressServer2.default; | ||
@@ -62,0 +73,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
{"name":"express-api-common","version":"2.0.0","description":"an api to receive and ingest product exports","scripts":{"commit":"git-cz","build":"babel src -d dist","lint":"eslint src __tests__","lint:fix":"eslint --fix src __tests__","test":"jest --config jest.json --coverage --verbose","test:watch":"jest --config jest.json --watch --coverage --verbose","precommit":"npm run lint:fix && npm run test","prepublish":"npm run build","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"main":"dist/server.js","files":["dist"],"repository":{"type":"git","url":"https://github.com/patrickleet/express-api-common.git"},"dependencies":{"body-parser":"^1.18.2","debug":"^3.1.0","express":"^4.15.5","healthcheck-middleware":"^1.0.1"},"devDependencies":{"babel-cli":"^6.24.1","babel-core":"^6.25.0","babel-eslint":"^7.2.3","babel-jest":"^20.0.3","babel-plugin-module-resolver":"^2.7.1","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^1.6.0","babel-register":"^6.24.1","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.2.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.7.0","eslint-plugin-node":"^5.1.1","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","husky":"^0.14.3","jest":"^21.1.0","llog":"0.0.13","regenerator-runtime":"^0.11.0","semantic-release":"^8.2.0"},"license":"ISC","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} | ||
{"name":"express-api-common","version":"3.0.0","description":"an api to receive and ingest product exports","scripts":{"commit":"git-cz","build":"babel src -d dist","lint":"eslint src __tests__","lint:fix":"eslint --fix src __tests__","test":"jest --config jest.json --coverage --verbose","test:watch":"jest --config jest.json --watch --coverage --verbose","precommit":"npm run lint:fix && npm run test","prepublish":"npm run build","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"main":"dist/server.js","files":["dist"],"repository":{"type":"git","url":"https://github.com/patrickleet/express-api-common.git"},"dependencies":{"body-parser":"^1.18.2","debug":"^3.1.0","express":"^4.16.2","express-prom-bundle":"^3.3.0","healthcheck-middleware":"^1.0.1"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-eslint":"^8.2.2","babel-jest":"^22.4.0","babel-plugin-module-resolver":"^3.1.0","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^1.6.1","babel-register":"^6.26.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.1.0","eslint":"^4.18.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.8.0","eslint-plugin-node":"^6.0.0","eslint-plugin-promise":"^3.6.0","eslint-plugin-standard":"^3.0.1","husky":"^0.14.3","jest":"^22.4.0","llog":"0.0.13","regenerator-runtime":"^0.11.1","semantic-release":"^8.2.3"},"license":"ISC","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} |
6016
116
5
+ Addedexpress-prom-bundle@^3.3.0
+ Addedbintrees@1.0.2(transitive)
+ Addedexpress-prom-bundle@3.3.0(transitive)
+ Addedprom-client@10.2.3(transitive)
+ Addedtdigest@0.1.2(transitive)
+ Addedurl-value-parser@1.0.0(transitive)
Updatedexpress@^4.16.2