Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request failed with status code 404 #78

Open
walkerenock opened this issue Mar 23, 2021 · 1 comment
Open

Request failed with status code 404 #78

walkerenock opened this issue Mar 23, 2021 · 1 comment

Comments

@walkerenock
Copy link

everything has been going well as am building shopping cart, but when i click in product it says request failed with status code 404.
here is my server.js

`import express from 'express';
import data from './data.js';

const app = express();

app.get('/api/Products/:id', (req, res) => {
const product = data.products.find((x) => x._id === req.params.id);
if (product) {
res.send(product);
} else {
res.status(404).send({ message: 'Product Not Found' });
}
});

app.get('/api/products', (req, res) => {
res.send(data.products);
});
app.get('/', (req, res) => {
res.send('Server is ready');
});
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(Serve at http://localhost: ${port});
});`

@sameer2470
Copy link

I also have this problem. Did you solve this ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants