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?