Matilde Enevoldsen
Matilde Enevoldsen

Reputation: 11

Firebase and crossroads user profile

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

Answers (1)

Oussema Aroua
Oussema Aroua

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

Related Questions