Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

325
Views
Obteniendo el error 404 para la solicitud de venta (usando express y node js)

Soy más o menos nuevo en el desarrollo web y he tenido problemas para obtener una solicitud PUT. Configuramos una base de datos y logramos que las solicitudes GET y POST funcionen, pero seguimos recibiendo un error 404 al intentar enviar una solicitud PUT.

 router.put('/edit-beverage/:id', (req, res) => { console.log(`Updating beverage on id ${data.params.id}:`); let data = req.body; query1 = `UPDATE Beverage ` query1 += `SET name = '${data.nameInput}', abv = ${data.abvInput}, breweryID = ${data.breweryID_FK}, categoryID = ${data.categoryID_FK} ` query1 += `WHERE beverageID = ${data.params.id};` db.pool.query(query1, (err, rows, fields) => { res.redirect('/'); }); });

Esto es lo que tenemos en otra página.

 let express = require('express'); // We are using the express library for the web server let app = express(); // We need to instantiate an express object to interact with the server in our code PORT = process.env.PORT || 3000;; // Set a port number at the top so it's easy to change in the future app.use(express.json()); app.use(express.urlencoded({extended: true})); // Cors should allow access from extrernal addresses. var cors = require('cors') app.use(cors()) // Database const db = require('./database/db-connector') /* ROUTES */ // create new Router instance for api routes // mount the router on the app app.use('/', require('./routes')); module.exports = app; let router = require('express').Router();

Y esto es lo que trato de enviar en Postman. Por lo que puedo decir, el punto final es el mismo que está en el archivo

¿Alguien podría decirme qué está pasando? Estoy confundido en cuanto a por qué el servidor no reconoce la solicitud como una ruta adecuada.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!