I've always used Backbone's routes (#!/blah)
But I realize that in order to get indexed by Google, you need to provide a non-javascript version of the site.
I don't like to write code twice. So, I would rather build a multi-page app instead of a single page web app.
Backbone.js provides me with the "structure" so my javascript does not turn into sphagetti mess. But , I'm completely clueless on how to build multi-page apps using Backbone.
Do you include the main.js file on every page render? What about routes? How do you deal with that? How do you deal with modularizing, etc?
I wish there was a tutorial on how to build multi-page javascript apps using Backbone.
Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.
Backend Synchronization BackboneJS is use with the front-end and back-end systems, allows the synchronization with the backend to provide support to RESTful APIs.
Backbone. js is a model view controller (MVC) Web application framework that provides structure to JavaScript-heavy applications. This is done by supplying models with custom events and key-value binding, views using declarative event handling and collections with a rich application programming interface (API).
Vue. js, React, AngularJS, Angular 2, and Ember. js are the most popular alternatives and competitors to Backbone. js.
There are a lot of considerations for doing something like this, but here are two keys one:
You probably want to have your web server route everything to the serve the same static page (assuming it is static assets). This means that everything in http://yourdomain.com/*
will serve /var/www/yourdomain.com/index.html
. Once the static page is loaded, the JS on that page will decide what to do given the url.
To do your routing, you can still use backbone routing, but don't use hashbangs (the #!/blah
style urls). See http://backbonejs.org/#History for instance. This will allow you to navigate to real URLs without actually needing a page refresh. If the browser doesn't support a pushState, everything will still work, but it will reload the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With