Im testing my API with postman, when I try to send data in the URL Postman responds with 404 Not found. I guess Its the format but searching around I think its correct. Can anyone throw some light please?
But when I dont send any data in the URL it works just fine:
When I try to send data in the get request:
app.get("/mediciones/sigfox_libelium/:{device}", (req, res) => {
const { device } = req.params;
res.json("im in");
console.log("Im in");
console.log(device);
console.log(req.params.device);
When I send no data on the request works just fine(it crashes but its becouse its not finished yet):
app.get("/mediciones/sigfox_libelium", (req, res) => {
const { device} = req.params;
res.json("im in");
console.log("Im in");
console.log(device);
console.log(req.params.device);
My guess is you're using Express.js to build API right?
I think you use req.params
in the wrong way.
If you want params name device
You have to use :device
instead of :{device}
in url path.
Like this
app.get("/mediciones/sigfox_libelium/:device", (req, res) => {
cosnt { device } = req.params // You can get device here
})