Okay, we're not all guys, but here goes:
you've got three things here: storing documents, identifying them with an ID (which can be or be part of a URL), and then the program that maps a URL being requested to the thing that loads that part from the database.
The way similar systems do it are one of two ways: A random ID -- like gist, they generate a random number, and then use that as the ID for a document. The other is that the ID is generated by hashing the document itself -- "content addressable storage"; this is what git does internally. That gets into complexity when things can change, since changing the content changes the hash. For a simple site, go with random number generation. It can be a UUID, it can be a random series of bytes expressed as hexadecimal (or even a tighter packing if you want shorter IDs)
Then you need a database -- any key-value store works. the filesystem's actually a great thing for cases like this. So are databases like leveldb. Even networked databases like mongodb or mysql work well.
Then you have to generate URLs -- it can be as simple as concatenation.
"http://myserver/files/" + id would be the url of your document.
Then you write something to tie those together. In an express app, that might be this:
app.get('/files/:id', function (req, res, next) {
myDb.get(req.params.id, function (err, data) {
if (err) return next(err);
render('viewFile', { file: data });
});
});
Good luck!
Aria