We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f6af98 commit 47a9310Copy full SHA for 47a9310
body_parser_example.js
@@ -1,13 +1,14 @@
1
const express = require("express");
2
const app = express();
3
+const PORT = 3000;
4
5
app.use(express.json());
6
-app.post("/users", function(req, res) {
7
- const userName = req.body.name;
8
- res.send(`${userName} is created.`);
+app.post("/users", (req, res) => {
+ const userName = req.body.username;
9
+ res.send(`You would like to create a user with username: ${userName}.`);
10
});
11
-const server = app.listen(3000, function() {
12
- console.log("Application started....");
+const server = app.listen(PORT, () => {
13
+ console.log(`Server running at http://localhost:${PORT}`);
14
0 commit comments