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

220
Views
Making the client able to receive custom parameters from a URL using Express/NodeJS

I am trying to create a nodeJS/Express site where users are able to create posts. Each post has its own id (consisted of 6 random characters). I want to make it so that when a user enters the URL http://localhost:3000/post/123456/, the user sees HTML on their screen but the id of the post they're trying to see, that means the second parameter in the URL (In this case, 123456) is given to the client.

For example, if the user goes on http://localhost:3000/post/111111/, I want the client to see HTML, but, I want the Javascript on that page to receive that id (111111), either in a variable or in a cookie.

I've tried using express app.get, like this:

app.get("/post/:id", (req, res) => {
    req.send(req.params.id)
})

But, obviously that didn't work, since that doesn't send back HTML, but instead sends back a string. Is there any way of doing that, or at least something similar to that?

over 4 years ago · Santiago Trujillo
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!