async bois!
This commit is contained in:
parent
80e7b59fe3
commit
2e5f7eafdc
11
index.js
11
index.js
@ -20,16 +20,17 @@ app.use(bodyParser.json(),function (req, res, next) {
|
||||
app.get('/lobby/list' , async function (req, res) {
|
||||
lobby.list().then(r => {
|
||||
console.log(r)
|
||||
res.send(JSON.stringify({gamesArr: r }))
|
||||
})
|
||||
console.log()
|
||||
result=""
|
||||
res.send(JSON.stringify({gamesArr: result }))
|
||||
})
|
||||
|
||||
//get game details
|
||||
app.get('/lobby/details', function (req, res) {
|
||||
app.get('/lobby/details/:gameID', function (req, res) {
|
||||
let obj=req.body
|
||||
res.send(lobby.details(obj.gameID))
|
||||
lobby.details(obj.gameID).then(r => {
|
||||
res.send(JSON.stringify(r))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//post register player
|
||||
|
12
lobby.js
12
lobby.js
@ -3,14 +3,12 @@ const uuidv4 = require('uuid/v4');
|
||||
|
||||
var lobby={
|
||||
list: async () => {
|
||||
mongo.get("embezzle","gamelist",{}).then(result => {
|
||||
return(result)
|
||||
})
|
||||
result = await mongo.get("embezzle","gamelist",{})
|
||||
return(result)
|
||||
},
|
||||
details: (gameID) => {
|
||||
mongo.get("embezzle","gamelist",{"gameID":gameID}).then(result => {
|
||||
return (result)
|
||||
})
|
||||
details: async (gameID) => {
|
||||
result = await mongo.get("embezzle","gamelist",{"gameID":gameID})
|
||||
return (result)
|
||||
},
|
||||
register: (name) => {
|
||||
id=uuidv4()
|
||||
|
Loading…
Reference in New Issue
Block a user