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

152
Views
No recuperar ningún dato usando axios y tv maze api

Estoy tratando de obtener datos de búsqueda usando el complemento axios de TV Maze Api

 <form method="POST" action="/results"> <input type="text" name="searchTerm" placeholder="Search for shows"> <input type="submit" value="Search"> </form>

Estoy usando un manillar para publicar la información en mi app.js

 //Sets up results page app.get("/results", mware.requireLogin, function(req, res) { const simplifiedUser = { username: req.user._doc.username, isAdmin: req.user._doc.isAdmin }; res.render("results", { message: req.flash('info'), user: simplifiedUser }); }); // Process the form submission app.post('/results', async function(req, res) { const results = await showService.searchShows(req.body.searchTerm); if(results && results.shows) { res.render('results', { results: results.shows, searchTerm: req.body.searchTerm }); } else { res.render('error'); } });

Luego lo envía para recuperar esos datos, pero no regresa nada. Sigue omitiendo los datos y va directamente a mostrar el mensaje de error.

 const showService = { searchShows: async (term) => { //searches for shows // /search/shows?q=query try { const options = { params: { term, } }; const response = await axios.get(show_api + '/search/shows?q=', options); if(response && response.data){ return response.data; } else { return ["did not work"]; } //console.log(response); } catch (error) { console.error(error.response.data); } }

};

alguna solucion me ayudaria mucho gracias

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!