Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda