Ask coding questions

← Back to all posts
Another question about links for your website.
maxina (59)

So in my last post, I asked a question about this topic, and coder100 was quite helpful, so I'm just going to ping you.

SO my question is, let's say my website has users and I want to have a URL for each profile. For example:

How do I do this?? I hope this makes sense btw.

Edit: btw im just using vanilla js with node js and socketIO


Answered by Coder100 (18057) [earned 5 cycles]
View Answer
Coder100 (18057)


you can do something like params

app.get("/user/:username", (req, res) => {
  res.end("Your username was: " + req.params.username);

glad I could help

by the way

I recommend at this stage using something like ejs

maxina (59)

@Coder100 ohhh i see thanks! Will check ejs out

SixBeeps (5225)

The answer depends on your backend framework. I'd take a look at your framework's URL routing methods to see if any of those match what you're looking for.

Strangely enough, from what I've seen, Django handled this kind of use case the best.

maxina (59)

@SixBeeps um im just using vanilla js with node js and socketIO

SixBeeps (5225)

@maxina Are you using Node's HTTP libs to host a server? Is that what's handling the user database?