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

236
Views
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 answers
Answer question

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 Report
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!