Skip to content

Commit 87b7cc3

Browse files
authored
Merge pull request #3 from Zegnat/bugfix/have-express-parse-form-submission
Swap querystring for body-parser
2 parents 76cbc33 + d2b032d commit 87b7cc3

3 files changed

Lines changed: 2 additions & 10 deletions

File tree

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const express = require("express");
22
const { mf2 } = require("microformats-parser");
33
const undici = require("undici");
4-
const querystring = require("querystring");
54
const pkg = require("./package.json");
65
const app = express();
76
const port = process.env.PORT || 9000;
@@ -44,9 +43,8 @@ app.get("/", async (req, res) => {
4443
});
4544
}
4645
});
47-
app.post("/", (req, res) => {
48-
const qsBody = querystring.parse(req.body);
49-
htmlToMf2(qsBody.url, qsBody.html, res);
46+
app.post("/", express.urlencoded({ extended: false }), (req, res) => {
47+
htmlToMf2(req.body.url, req.body.html, res);
5048
});
5149

5250
app.listen(port, () => {

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"ejs": "^3.1.8",
1515
"express": "^4.18.1",
1616
"microformats-parser": "^1.4.1",
17-
"querystring": "^0.2.1",
1817
"undici": "^5.6.1"
1918
}
2019
}

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,6 @@ qs@6.10.3:
420420
dependencies:
421421
side-channel "^1.0.4"
422422

423-
querystring@^0.2.1:
424-
version "0.2.1"
425-
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd"
426-
integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==
427-
428423
range-parser@~1.2.1:
429424
version "1.2.1"
430425
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"

0 commit comments

Comments
 (0)