I'm using Express.js (3.0) to develop a Node web app; I'd like to have clean URLs for both user profiles:
domain.com/username
as well as for pages each user creates and shares:
domain.com/username/pagename
I really prefer the clean URLs to using something like domain.com/profile/username or domain.com/pages/username/pagename.
The current route configuration for our development is bootstrapped like so:
app.get('/', content.home);
app.get('/about', content.about);
app.get('/signup', users.signup);
app.get('/login', users.login);
app.get('/:user', users.profile);
app.get('/:user/:userpage', userpage.render);
The last two being the catch all routes. Now this works fine, but I'm not sure if it's a bad design or implementation.
More importantly, I'd like to reserve a 100 or so page names for future use, like 'contact', 'careers', 'cancels', 'pricing', etc. I don't plan to launch with these pages, but I'm wondering if I can create a route file that captures these requests and sends them to a placeholder page, rather than them being evaluated as a user profile or user generated page.
I can obviously prevent those usernames from being created, but there's got to be a creative approach for the routing as well, and understand any other considerations when using catch-all root level routing-- this can cause an unwieldily amount of DB strain due to the user and page look ups for non-existing objects or pages.