Skip to content

Commit 090a334

Browse files
authored
Merge pull request #45 from Dreamerryao/master
upd: 删除body-parser依赖
2 parents 2598600 + e05e4a9 commit 090a334

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"babel-eslint": "^10.1.0",
5454
"babel-loader": "^8.2.2",
5555
"babel-plugin-import": "^1.13.3",
56-
"body-parser": "^1.19.0",
5756
"clean-webpack-plugin": "^3.0.0",
5857
"copy-webpack-plugin": "^9.0.1",
5958
"css-loader": "^6.0.0",

server.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/** 用于开发环境的服务启动 **/
22
const path = require("path"); // 获取绝对路径有用
33
const express = require("express"); // express服务器端框架
4-
const bodyParser = require("body-parser");
54
const env = process.env.NODE_ENV; // 模式(dev开发环境,production生产环境)
65
const webpack = require("webpack"); // webpack核心
76
const webpackDevMiddleware = require("webpack-dev-middleware"); // webpack服务器
@@ -14,8 +13,8 @@ const app = express(); // 实例化express服务
1413
const DIST_DIR = webpackConfig.output.path; // webpack配置中设置的文件输出路径,所有文件存放在内存中
1514
let PORT = 8888; // 服务启动端口号
1615

17-
app.use(bodyParser.urlencoded({ extended: false }));
18-
app.use(bodyParser.json());
16+
app.use(express.urlencoded({ extended: false }));
17+
app.use(express.json());
1918

2019
/** 监听POST请求,返回MOCK模拟数据 **/
2120
app.post(/\/api.*/, (req, res, next) => {

0 commit comments

Comments
 (0)