I'm looking for a professional technique to generate unique URL addresses. I created a node.js server that should give out these URLs to accessing clients. How can I provide the URLs?
// user is connecting to www.privatebox.de
// server serves index.html with unique ID
// e.g. www.privatebox.de/8yfuzyzzm7
For a robust solution, I would consider using node-uuid to generate UUIDs.
Install the package with NPM:
Based on the sample code from the GitHub project page:
If you're looking for a shorter, more url-friendly unique ID, then ShortId might be a decent option for you, although the chance of collisions will be higher. ShortId will generate ids like this:
Finally, I suggest you look at this SO question for generating unique ids in javascript.