0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

fix: move bodyParse to the upper level (#1841)

Co-authored-by: Juan Picado <juanpicado19@gmail.com>
This commit is contained in:
Robert Sabirov 2020-06-19 08:40:06 +03:00 committed by GitHub
parent 99dc8510fc
commit 67c31b69ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -3,7 +3,6 @@ import { Config } from '@verdaccio/types';
import _ from 'lodash';
import express from 'express';
import bodyParser from 'body-parser';
import whoami from './api/whoami';
import ping from './api/ping';
import user from './api/user';
@ -42,7 +41,6 @@ export default function(config: Config, auth: IAuth, storage: IStorageHandler) {
app.param('anything', match(/.*/));
app.use(auth.apiJWTmiddleware());
app.use(bodyParser.json({ strict: false, limit: config.max_body_size || '10mb' }));
app.use(antiLoop(config));
// encode / in a scoped package name to be matched as a single parameter in routes
app.use(encodeScopePackage);

View file

@ -1,5 +1,6 @@
import _ from 'lodash';
import express, { Application } from 'express';
import bodyParser from 'body-parser';
import compression from 'compression';
import cors from 'cors';
import { HttpError } from 'http-errors';
@ -46,6 +47,8 @@ const defineAPI = function(config: IConfig, storage: IStorageHandler): any {
hookDebug(app, config.self_path);
}
app.use(bodyParser.json({ strict: false, limit: config.max_body_size || '10mb' }));
// register middleware plugins
const plugin_params = {
config: config,