I cannot figure out why I am getting this 404 error. I have quadruple checked links, spelling, spaces, everything.
My server port is running and my database is connected
My url is http://localhost:8080/add-contact
This is my routes.js
const ContactList = require('./Model/ContactList');
app.post('/add-contact', async (request, response) => {
const contactList = new ContactList(request.body);
try {
await contactList.save();
response.status(201).json({
status: 'Success',
data: {
contactList
}
});
} catch (err) {
response.status(500).json({
status: 'Failed',
message: err
});
}
});
- I checked the url spelling and for additional spaces
- Checked I am connected to the right port
- Made sure the body format is in JSON
- Content Type is βapplication/jsonβ