mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
chore(modernize): remove express-validator
This commit is contained in:
parent
3c8e51118e
commit
62e6d1075a
@ -10,7 +10,6 @@ const errorHandler = require('errorhandler');
|
||||
const unleashSession = require('./middleware/session');
|
||||
const responseTime = require('./middleware/response-time');
|
||||
const requestLogger = require('./middleware/request-logger');
|
||||
const validator = require('./middleware/validator');
|
||||
const simpleAuthentication = require('./middleware/simple-authentication');
|
||||
|
||||
module.exports = function(config) {
|
||||
@ -33,7 +32,6 @@ module.exports = function(config) {
|
||||
app.use(unleashSession(config));
|
||||
app.use(responseTime(config));
|
||||
app.use(requestLogger(config));
|
||||
app.use(validator(config));
|
||||
|
||||
if (config.publicFolder) {
|
||||
app.use(favicon(path.join(config.publicFolder, 'favicon.ico')));
|
||||
|
@ -1,15 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const ValidationError = require('./validation-error');
|
||||
|
||||
function validateRequest(req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (req.validationErrors()) {
|
||||
reject(new ValidationError('Invalid syntax'));
|
||||
} else {
|
||||
resolve(req);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = validateRequest;
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const validator = require('express-validator');
|
||||
|
||||
module.exports = function() {
|
||||
return validator({
|
||||
customValidators: {
|
||||
isUrlFriendlyName: input => encodeURIComponent(input) === input,
|
||||
},
|
||||
});
|
||||
};
|
@ -66,7 +66,6 @@
|
||||
"deep-diff": "^1.0.0",
|
||||
"errorhandler": "^1.5.0",
|
||||
"express": "^4.16.3",
|
||||
"express-validator": "^5.2.0",
|
||||
"gravatar": "^1.6.0",
|
||||
"install": "^0.12.0",
|
||||
"joi": "^14.0.0",
|
||||
|
13
yarn.lock
13
yarn.lock
@ -2352,14 +2352,6 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
|
||||
dependencies:
|
||||
homedir-polyfill "^1.0.1"
|
||||
|
||||
express-validator@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/express-validator/-/express-validator-5.2.0.tgz#28f068fc676022acfe182c97fd9e780f9ffb26f6"
|
||||
integrity sha512-FyQ7gAaNwnIYvtfagy+fDrtzjNDFKRVjzplCPDXEu8fxSR/XBdXZHAtLR22446GWlw48LZPSKldqUVmySBWApA==
|
||||
dependencies:
|
||||
lodash "^4.17.10"
|
||||
validator "^10.1.0"
|
||||
|
||||
express@^4.16.3:
|
||||
version "4.16.3"
|
||||
resolved "https://registry.yarnpkg.com/express/-/express-4.16.3.tgz#6af8a502350db3246ecc4becf6b5a34d22f7ed53"
|
||||
@ -7232,11 +7224,6 @@ validate-npm-package-license@^3.0.1:
|
||||
spdx-correct "~1.0.0"
|
||||
spdx-expression-parse "~1.0.0"
|
||||
|
||||
validator@^10.1.0:
|
||||
version "10.2.0"
|
||||
resolved "https://registry.yarnpkg.com/validator/-/validator-10.2.0.tgz#61d6b10c3d5c9f368c75c2ce8ca2b792522eaafa"
|
||||
integrity sha512-gz/uknWtNfZTj1BLUzYHDxOoiQ7A4wZ6xPuuE6RpxswR4cNyT4I5kN9jmU0AQr7IBEap9vfYChI2TpssTN6Itg==
|
||||
|
||||
vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
|
Loading…
Reference in New Issue
Block a user