Thursday 19 January 2017

Question about Node, Express, and dynamic routing.

I have started to get the hang of Node and have started playing with express to display some very very simple pages. Right now I have a chat bot for twitch. The users are all pulled from a database and stored in memory. I would like to use express to display some very basic information about a user by going to /username. I can make it work by hardcoding app.get statements likeapp.get('/azazael13', function (req,res) { res.send (stuff for that user); }); I would like to be able to do this automatically by going through my list of users, and having express generate the pages on the fly. Is this possible? If not, is there a solution that would work that doesn't require hardcoding?

Submitted January 20, 2017 at 01:11AM by azazael13

No comments:

Post a Comment