Backend routing working on localhost but not on deployment

So, I set up this backend using expressJS for a react app that I am working on. And when I use vs code’s thunderclient to send HTTP requests and see if routing works, it works and I see what I should see (an array of objects showing the products), but when I try to access a route on backend deployment (i.e https://web-app-popular-electronics-backend.onrender.com/productos) I get a 502 getway error. When checking logs, I see that the request timed out. Why is this happening?

This would be my routing code, it’s very basic as I’m a newbie.

const { Router } = require(‘express’);

const product_router = Router();

const { getProducts, addProduct, deleteProduct, updateProduct } = require(‘…/controllers/products.controller’)

product_router.get(‘/’, getProducts);

//admin required

product_router.post(‘/’, addProduct);

//admin required

product_router.delete(‘/:referencia’, deleteProduct);

//admin required

product_router.put(‘/:referencia’, updateProduct);

module.exports = product_router;

Any ideas?

Hi David,

Are you still running into this issue? I’m currently seeing a successful response on the route that you linked.

Let me know if you still require assistance.

Best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.