Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

368
Vistas
why I am getting undefined when I try to access on my property in node js

I have sent data from frontend to backend when I console what type of requests I have gotten I can see the data is showing into the console but when I try to access those properties I got undefined. I have also tried with a query, body but both get undefined when I try to access the property.

enter image description here

Backend code:

   // DELETE SHORT URL
        app.delete('/delete/:shortUrl', async (res, req) => {
            console.log(req);
            console.log(req.params, 'req.params');
        })

Frontend:

 // DELETE 
    const deleteUrl = (id) => {
            fetch(`http://localhost:5000/delete/${id}`, {
                method: 'DELETE'
            }).then(res => res.json())
                .then(data => {
                    console.log(data);
                    if (data.deletedCount) {
                        alert('Order Deleted')
                        // const remainingOrders = orders.filter(order => order._id !== id)
                        // setOrders(remainingOrders)
                    }

                })
                .finally(() => setLoadings(false))
    
    }
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Based on the Express documentation, the route callback's parameters (req & res) are reversed, so you should have:

app.delete('/delete/:shortUrl', (req, res) => {
  console.log(req);
  console.log(req.params, 'req.params');
})
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda