I have this on the client:
var Article = Backbone.Model.extend({
urlRoot: '/wiki'
});
var ArticleView = Backbone.View.extend({
render: function(){
var article = new Article({term:'test'});
article.fetch(); //sends a request to wiki, not to wiki/:term as i want to
}
});
and this on the server (node):
//Never gets hit
app.get('/wiki/:term', function(req, res){
console.log('/wiki/term');
});
app.get('/wiki', function(req, res){
console.log('/wiki');
console.log(req.params.term); //produces 'undefined'
});
What do i need to do to make backbone fetch from the correct route (i.e wiki/:term) and actually send the term parameter to the server?
EDIT:
i was able to retrieve the request parameter on the server side using req.query.term
, not req.params.term