Using clementinejs with Timestamp: routing

Using clementinejs with Timestamp: routing
0

#1

I’m using the clementinejs boilerplate for the BaseCamp Microservices projects; currently I’m working on Timestamp.
I was able to build the entire application without the use of clementinejs, however, the instructions say to use a full stack boiler plate like clementinejs.
Without it, I used the app.get approach to allow urls like this: /witcradg/timestamp or like this: /witcradg/timestamp/123456789
app.get(’/*’, function (req, res) {
var decodedSubmission = decodeURI(req.url).slice(1);

Now I’m trying to understand the mechanism for enabling parameter passing using the approach in the clementinejs boilerplate that breaks routes into an index.js file using app.route…
app.route(’/’).get( function (req, res) {
res.sendFile(process.cwd() + ‘/public/index.html’); });

I’ve tried a number of approaches but can’t seem to get access to parameters passed on the url. I always get
Cannot GET /witcradg/timestamp/123456789
How can I solve this and where can I find documentation on the correct approach?


#2

Spoiler Alert: My router code contains the logic since it was so short.
You can see my solution to this here:


The solution is implemented in the server.js and
app/routes/index.js files.

I’m not sure if it follows best practices, but it works. I’d appreciate anyone’s comments about improving the quality of the code.
Note: I believe app.router has been removed in Express4.x