Skip to content

Commit 47a9310

Browse files
[mabel] Edit body_parser_example
1 parent 0f6af98 commit 47a9310

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

body_parser_example.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
const express = require("express");
22
const app = express();
3+
const PORT = 3000;
34

45
app.use(express.json());
56

6-
app.post("/users", function(req, res) {
7-
const userName = req.body.name;
8-
res.send(`${userName} is created.`);
7+
app.post("/users", (req, res) => {
8+
const userName = req.body.username;
9+
res.send(`You would like to create a user with username: ${userName}.`);
910
});
1011

11-
const server = app.listen(3000, function() {
12-
console.log("Application started....");
12+
const server = app.listen(PORT, () => {
13+
console.log(`Server running at http://localhost:${PORT}`);
1314
});

0 commit comments

Comments
 (0)