Skip to content

Commit

Permalink
firebase integration to get the data
Browse files Browse the repository at this point in the history
  • Loading branch information
rishz committed Mar 9, 2017
1 parent 4b51e00 commit d619ed8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 0 additions & 4 deletions database.js

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "server.js",
"dependencies": {
"body-parser": "^1.17.1",
"convert-radix64": "^0.2.0",
"express": "^4.15.2",
"firebase": "^3.7.0",
"hasha": "^2.2.0"
Expand Down
8 changes: 6 additions & 2 deletions shortner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Created by rishabhshukla on 09/03/17.
*/
var firebase = require('firebase');
const r = require('convert-radix64');

var config = {
apiKey: "AIzaSyBAAUCZ8xXzS4r7jxMhlvPB6OzKIC0MRE8",
Expand All @@ -23,13 +24,16 @@ module.exports = {
// conv = atob(hashInt);

hashMap[hash] = url;
writeUserData(url,hash);
writeUserData(r.from64(hash),hash);

return hash;

},
expand: function (shortcode) {
return hashMap[shortcode];
return firebase.database().ref().once(shortcode).then(function(snapshot) {
var username = snapshot.val().url;
});
// return hashMap[shortcode];
}

};
Expand Down

0 comments on commit d619ed8

Please sign in to comment.