node.jsexpresshandlebars.jssammy.js

Can express.js handle front end routing like sammy.js


We are starting a project at work and we have used sammy.js with handlebars.js to handle the front end rendering. We are moving this new project to node and using express.js. Do we still need to use sammy.js for front end routing? We do not plan to use any front end framework currently.


Solution

  • Sammy.js is a routing framework designed for single page webapps. That is, Sammy is traditionally used for requests that will never leave your browser and are handled by a set of Javascript code running within it.

    Express is used for server side routing, or in other words requests that hit your server. In this case, your server would render the page, then hand the rendered response back to the browser.

    You can use both of them together, or use one over the other. The question you should really ask while architecting your app is whether your app is better off as a single page webapp or a multi-page app? For that, I'll refer you to this question: Single Page Application: advantages and disadvantages