const express = require("express");
const app = express();
const port = 3002;
app.use(express.json()); // you need the body parser middleware
// which already comes in express as a method
app.get("/", (req, res) => res.send("Hello World!"));
app.post('/', function (req, res) {
const { data } = req.body;
// post:
// {
// "data": {
// "name": "Jhon",
// "age": 25
// }
// }
res.send('POST request to the homepage')
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`));