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

195
Vistas
Can an <a> tag send a GET request?

I'm building a website in Node.js, Express, and EJS. In the past, I have created forms where the button is of type="submit". I would then have my index.js file do a res.render to pull up the ejs file I'm trying to route to.

Right now, I'm trying to route from an <a> tag to an ejs file called "/jsonData".

I've added the GET request in my index.js file:

app.get('/jsonData', (req, res) => {
    res.render('jsonData');
});

and I've added the a tag in my home.ejs file:

<li class="nav-item">
   <a class="nav-link" href="/jsonData">JSON Data</a>
</li>

My jsonData file is in my views folder because I set app.set('view engine', 'ejs'); earlier in the index.js file.

My home.ejs file runs great when I start the server using node index.js, but when I click on the link to go to my jsonData page, I get the error: Cannot GET /jsonData

I'm sure I'm probably doing something obviously wrong but I don't know what to do.

Thank you in advance!!

about 4 years ago · Juan Pablo Isaza
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