Skip to content

Commit 822cf93

Browse files
committed
chore: use body-parser module for parsing bodies of application/json type
1 parent 65b5f8f commit 822cf93

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

examples/js/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
const bodyParser = require('body-parser')
12
const express = require('express')
23
const mysql = require('mysql')
34

45
const app = express()
56
app.set('x-powered-by', false)
7+
app.use(bodyParser.json())
68

79
const pool = mysql.createPool({
810
connectionLimit: 2,

examples/js/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"start": "node app.js"
66
},
77
"dependencies": {
8+
"body-parser": "~1.19.0",
89
"express": "~4.17.1",
910
"mysql": "~2.18.1"
1011
}

src/templates/app.js.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
const bodyParser = require('body-parser')
12
const express = require('express')
23
const mysql = require('mysql')
34

45
const app = express()
56
app.set('x-powered-by', false)
7+
app.use(bodyParser.json())
68

79
const pool = mysql.createPool({
810
connectionLimit: 2,

src/templates/package.json.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"start": "node app.js"
66
},
77
"dependencies": {
8+
"body-parser": "~1.19.0",
89
"express": "~4.17.1",
910
"mysql": "~2.18.1"
1011
}

0 commit comments

Comments
 (0)