express-udb v1.7.6
app.get('/home',(req,res,next)=>{ if(udb.ifLogedIn() === true){//if user is loged in (also authenticates) udb.Authenticate({//Authenticate user success:function(){//if authetication ok res.sendFile(__dirname+'/html/home.html')//send home page }, err:function(){//if authetication not ok res.redirect('/login')//take to login } }) }else{//if user not loged in res.redirect('/login')//take user to login page } }) server.listen(8080)//start server
// changeing this user data $.udb.ChangeUser.name("new name",()=>{//changes this user user name //do something when done }) $.udb.ChangeUser.status("new status",()=>{//changes this user status //do something when done }) $.udb.ChangeUser.profilePhoto("new profile photo url",()=>{//changes this user profile photo url //do something when done }) $.udb.ChangeUser.settings({somerandomething:"blahblah"},()=>{//changes user settings, this is a json array for user settings //do something when done })
//get other user data $.udb.GetClientUserData("userid",(clientdata)=>{//gets other client data console.log(clientdata)//logs client data array })
//handeling Contacts $.udb.addContact('userid',(result)=>{ // add contact, result will be true if ok, false if user doesnt exist }) $.udb.removeContact('userid',(result)=>{ // add remove, result will be true if ok, false if user doesnt exist }) $.udb.blockContact('userid',(result)=>{ //blockes contact to send inbox, message and online data,result will be true if ok and false if user does not exist })
$.udb.unblockContact('userid',(result)=>{ //unblockes contact to send inbox, message and online data,result will be true if ok and false if user does not exist })
//chating usage
$.udb.sendMessage("userid","message content",()=>{
//do something when done
})
$.udb.getChatData("userid",(chatdata)=>{
//returns chatdata with user in array form
/example
{
to:"who the message is too",
from:"who the message is from",
content:"the message content"
}
/
})
//LIVE FUNCTIONS
//emit that user is online
$.udb.live.emitOnline()
// active listen for functions $.udb.live.active({ onOnline:(id)=>{//if user goes online do something with id
}, onOffline:(id)=>{//if user goes offline do something with id
}, onMessage:(data)=>{//if this user gets message, message returns the same way a chat message does
}, })
//enable authetication loop example function autoReAuthenticateUser(){ setTimeout(()=>{ $.udb.authUpdate(()=>{//command for re establishing authtoken autoReAuthenticateUser()//recall })},4100000)// 7:50 timeout for reauth } autoReAuthenticateUser()
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago