简体   繁体   中英

Firebase and crossroads user profile

如何使用crossroads.js制作路由器系统,例如,如果我转到以下URL:localhost / user / {{username}},然后获取该用户的详细信息,则该URL将通过firebase输入。

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;
      // ...
        });
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM