var Backbone = require('backbone'),
SellerProfileView = require('./views/seller/SellerProfileView');
var Router = Backbone.Router.extend({
routes: {
":user_name" : "sellerProfile"
},
sellerProfile: function (username) {
"use strict";
var sellerProfile = new SellerProfileView({username: username});
}
});
module.exports = Router
var Router = require('./router'),
Backbone = require('backbone'),
$ = require('jquery');
var app = {
init: function () {
"use strict";
Backbone.$ = $;
this.router = new Router();
$(document).ready(function () {
Backbone.history.start({ pushState: true, route: '/' });
});
}
};
module.exports = app;
app.init();
I get the below error if i refresh the page without the hash
Error response
Error code 404.
Message: File not found.
Error code explanation: 404 = Nothing matches the given URI.
Please help.
pushState will try to load the ressource.And it seems your server is not loading anything at 'yourwebsiteurl.com/'
来源:https://stackoverflow.com/questions/38320519/backbone-route-with-push-state-not-working-on-page-refresh