Skip to content

Commit c3f26be

Browse files
committed
fix: body-parser middlewares import
1 parent 37344e2 commit c3f26be

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

packages/body/src/parser/json.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { OptionsJson } from 'body-parser';
2-
import { json } from 'body-parser';
2+
import bodyParser from 'body-parser';
33
import { coreHandler } from 'routup';
44

55
export function createJsonHandler(options?: OptionsJson) {
6-
const handler = json(options);
6+
const handler = bodyParser.json(options);
77

88
return coreHandler((req, res, next) => {
99
handler(req, res, next);

packages/body/src/parser/raw.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Options } from 'body-parser';
2-
import { raw } from 'body-parser';
2+
import bodyParser from 'body-parser';
33
import { coreHandler } from 'routup';
44

55
export function createRawHandler(options?: Options) {
6-
const handler = raw(options);
6+
const handler = bodyParser.raw(options);
77
return coreHandler((req, res, next) => {
88
handler(req, res, next);
99
});

packages/body/src/parser/text.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { OptionsText } from 'body-parser';
2-
import { text } from 'body-parser';
2+
import bodyParser from 'body-parser';
33
import { coreHandler } from 'routup';
44

55
export function createTextHandler(options?: OptionsText) {
6-
const handler = text(options);
6+
const handler = bodyParser.text(options);
77

88
return coreHandler((req, res, next) => {
99
handler(req, res, next);

packages/body/src/parser/url-encoded.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { OptionsUrlencoded } from 'body-parser';
2-
import { urlencoded } from 'body-parser';
2+
import bodyParser from 'body-parser';
33
import { coreHandler } from 'routup';
44

55
export function createUrlEncodedHandler(options?: OptionsUrlencoded) {
6-
const handler = urlencoded({
6+
const handler = bodyParser.urlencoded({
77
extended: false,
88
...(options || {}),
99
});

0 commit comments

Comments
 (0)