It is a simple code for sending a post request to a server but when I hit the end point it shows [Cannot get / "endpoint"]. However, when I send a get request, server responds with message "Ok". Please help me out here that what I am missing.
import express from 'express'
import bodyParser from 'body-parser'
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.post('/post', (req, res) => {
console.log('Got body:', req.body);
res.sendStatus(200);
});
app.listen(8080, () => console.log(`Started server at http://localhost:8080!`));`
Below is my Packago.json file.
The message I receive while hitting the endpoint is shown below