I'm trying out node and some frameworks for node atm, specifically locomotive. However, i seem to be stuck on routing using locomotive. A couple questions i can't find the answer to, so here goes:
why does the locomotive out-of-box install use index.html.ejs as a filename? Why not just index.ejs? What's the benefit?
i'm trying to add a route to a view: searchName.html.ejs which i added in the views folder. To achieve this i made a toolController like this:
var locomotive = require('locomotive').Controller, toolController = new Controller(); toolController.searchName = function() { this.render(); } module.exports = toolController;
I also added a route in routes.js like so:
this.match('searchName', 'tool#searchName');
However, that doesn't work (and yet it's what the documentation says ought to work). The result is a 404 error. So how do i make that route work?
Suppose i want to make a route to eg, anExample.html? How do i go about that? I notice that in the out-of-the-box app from locomotive, you cannot enter localhost:3000/index.html . Nor even localhost:3000/index This seems highly impractical to me, as there are plenty of users who'll add the specific page they want to go to. So how can i make that work?
PS: I went through all questions regarding this on stackoverflow and searched the web, but i still can't figure this out.enter code here