Reputation: 11
how can I make a router system with crossroads.js where if I go to for example this URL: localhost/user/{{username}} then get the details of that user there's entered in the URL with firebase.
Upvotes: 0
Views: 25
Reputation: 5339
get user detail once :
var database = firebase.database();
var route1 = crossroads.addRoute('/user/{username}', function(id){
firebase.database().ref('/user/' + id).once('value').then(function(snapshot) {
var username = snapshot.val().username;
// ...
});
});
Upvotes: 1