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

282
Views
Nextjs: 405 cuando se envía el formulario POST

Siguiendo este tutorial , estoy tratando de enviar un formulario en Nextjs pero obtengo un error 405 cuando intento POST a mi ruta api. Intenté usar tanto axios como la API fetch. Esto parece que debería ser simple de hacer, pero no estoy seguro de dónde me estoy equivocando. ¿Algo obvio que me estoy perdiendo? ¡Gracias!

/encuesta/crear

 const handleSubmit = async (event) => { event.preventDefault(); const testData = { title: surveyTitle, }; const res = await fetch("/api/survey", { method: "POST", body: JSON.stringify({ dataName: testData, }), headers: { "Content-Type": "application/json", }, }); };

/api/encuesta

 export default function handler(req, res) { console.log(req.body); res.status(200).json(JSON.stringify({ name: 'Success' })) }
about 4 years ago · Santiago Trujillo
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!