Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Backbone and Express routers work together in an Express application?

I have built several Backbone apps and appreciate the client-side code structure and organization. I'm moving into Node development, using Express, and I'm uncertain as to how Express and Backbone can work together in the handling of routes.

like image 448
AndrewHenderson Avatar asked Dec 17 '12 09:12

AndrewHenderson


People also ask

Is Express router a middleware?

Express is a routing and middleware web framework that has minimal functionality of its own: An Express application is essentially a series of middleware function calls.

Why do we need router in Express?

The express. Router() function is used to create a new router object. This function is used when you want to create a new router object in your program to handle requests.

Is Express used for backend?

Express. js is the most popular backend framework for Node. js, and it is an extensive part of the JavaScript ecosystem. It is designed to build single-page, multi-page, and hybrid web applications, it has also become the standard for developing backend applications with Node.

What is the difference between Express () and Express router ()?

The main difference is that express() is a top level function, which means it performs core functionality for the library and it contains its own methods where, as a matter of fact, Router is one, and that is why when we create a specific router we chain the Router() method on express , kind of like how we use app.


1 Answers

You need to understand that Node and Backbone are independent from each other.

  • Node is for server-side (e.g working with a database, api serving etc. ) .
  • Backbone is a client-side Javascript MVC framework which gives you a structure for organizing your client-side Javascript application. (the application in the browser)

You can have a Backbone application in your client-side and it can hook up to any back-end either Node, Rails, PHP etc...

For more info check MVVM pattern and Javascript frameworks on the client-side.

http://backbonetutorials.com/why-would-you-use-backbone/

http://addyosmani.com/blog/understanding-mvvm-a-guide-for-javascript-developers/

like image 77
Serdar Dogruyol Avatar answered Nov 02 '22 10:11

Serdar Dogruyol