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

114
Views
Enrutamiento mediante solicitudes de búsqueda y Express Handlebars

¿Alguien puede ayudarme a averiguar por qué no funciona? Hice el enrutamiento en un mercado web improvisado para mi cartera y enfrenté este problema. Estoy usando la solicitud de búsqueda get enviar al servidor de esta manera:

 $('#about').click(function (){ fetch('/about').then((e)=>{ console.log(e.body) }) }) $('.logo').click(function (){ fetch('/').then((e)=>{ console.log(e.body) }) })

y necesito enviar el hbs parcial al extremo del cliente. Esa es la forma en que lo hago:

 app.get('', (req,res)=>{ console.log('Server got index request') res.render('index', { title: 'Marketplace', name: 'name', about: false, index: true, clientScript: clientScript, stylefile: styleFile, studiopage:'link' }) app.get('/about', (req,res)=>{ console.log('Server got about request') res.render('index', { title: 'Marketplace', about: true, index: false, name: 'name', clientScript: clientScript, stylefile: styleFile, studiopage:'link' }) })

Esta es la estructura index.hbs :

 <main> {{#if about}} {{>about}} {{/if}} {{#if index}} {{>productRows}} {{/if}} </main>

Entonces, el problema es que el servidor recibe la solicitud, la devuelve junto con el valor correspondiente a la ruta deseada (por ejemplo, about: true ), pero el índice en el extremo del cliente no se actualiza.

¡Muchas gracias por adelantado por su ayuda!

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!