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

239
Visualizações
How to append client-side scripts to page in Node

I'm starting project ts, node, express. Is there a way to add typescript files to html/ejs that run on client side (so i have access to document e.t.c., just like in regular js script)?

So it would be something like:

  • Node server with express that returns html pages and handles users sign in/up requests.
  • Adding, deleting, changing elements in html on user's activity handles in scripts on client side.

I would appreciate pointing on what I misunderstood in whole node, express conception if I did.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Please refer to this link for detailed explaination: Serving html from express

You can basically serve html pages from express. On root request handler you can server index.html

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

Now in the index.html page have a link to /index route example:

<a href="/login">

Now, on server code have a route handler

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

login.html can now have a form with action

<form action="/signin" method="post">
<input type="text" name="username" placeholder="Username" required>
<input type="password" name="password" placeholder="Password" required>
<input type="submit" value="login">
</form>

Now, on server code have a route handler

app.post('signin', (req, res)=>{//handle logic here});
about 4 years ago · Juan Pablo Isaza Relatório
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