mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
fix: move bodyParse to the upper level (#1841)
Co-authored-by: Juan Picado <juanpicado19@gmail.com>
This commit is contained in:
parent
99dc8510fc
commit
67c31b69ca
2 changed files with 3 additions and 2 deletions
|
@ -3,7 +3,6 @@ import { Config } from '@verdaccio/types';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import bodyParser from 'body-parser';
|
|
||||||
import whoami from './api/whoami';
|
import whoami from './api/whoami';
|
||||||
import ping from './api/ping';
|
import ping from './api/ping';
|
||||||
import user from './api/user';
|
import user from './api/user';
|
||||||
|
@ -42,7 +41,6 @@ export default function(config: Config, auth: IAuth, storage: IStorageHandler) {
|
||||||
app.param('anything', match(/.*/));
|
app.param('anything', match(/.*/));
|
||||||
|
|
||||||
app.use(auth.apiJWTmiddleware());
|
app.use(auth.apiJWTmiddleware());
|
||||||
app.use(bodyParser.json({ strict: false, limit: config.max_body_size || '10mb' }));
|
|
||||||
app.use(antiLoop(config));
|
app.use(antiLoop(config));
|
||||||
// encode / in a scoped package name to be matched as a single parameter in routes
|
// encode / in a scoped package name to be matched as a single parameter in routes
|
||||||
app.use(encodeScopePackage);
|
app.use(encodeScopePackage);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import express, { Application } from 'express';
|
import express, { Application } from 'express';
|
||||||
|
import bodyParser from 'body-parser';
|
||||||
import compression from 'compression';
|
import compression from 'compression';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import { HttpError } from 'http-errors';
|
import { HttpError } from 'http-errors';
|
||||||
|
@ -46,6 +47,8 @@ const defineAPI = function(config: IConfig, storage: IStorageHandler): any {
|
||||||
hookDebug(app, config.self_path);
|
hookDebug(app, config.self_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.use(bodyParser.json({ strict: false, limit: config.max_body_size || '10mb' }));
|
||||||
|
|
||||||
// register middleware plugins
|
// register middleware plugins
|
||||||
const plugin_params = {
|
const plugin_params = {
|
||||||
config: config,
|
config: config,
|
||||||
|
|
Loading…
Reference in a new issue