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) {
|
app.get('/lobby/list' , async function (req, res) {
|
||||||
lobby.list().then(r => {
|
lobby.list().then(r => {
|
||||||
console.log(r)
|
console.log(r)
|
||||||
|
res.send(JSON.stringify({gamesArr: r }))
|
||||||
})
|
})
|
||||||
console.log()
|
|
||||||
result=""
|
|
||||||
res.send(JSON.stringify({gamesArr: result }))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
//get game details
|
//get game details
|
||||||
app.get('/lobby/details', function (req, res) {
|
app.get('/lobby/details/:gameID', function (req, res) {
|
||||||
let obj=req.body
|
let obj=req.body
|
||||||
res.send(lobby.details(obj.gameID))
|
lobby.details(obj.gameID).then(r => {
|
||||||
|
res.send(JSON.stringify(r))
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
//post register player
|
//post register player
|
||||||
|
12
lobby.js
12
lobby.js
@ -3,14 +3,12 @@ const uuidv4 = require('uuid/v4');
|
|||||||
|
|
||||||
var lobby={
|
var lobby={
|
||||||
list: async () => {
|
list: async () => {
|
||||||
mongo.get("embezzle","gamelist",{}).then(result => {
|
result = await mongo.get("embezzle","gamelist",{})
|
||||||
return(result)
|
return(result)
|
||||||
})
|
|
||||||
},
|
},
|
||||||
details: (gameID) => {
|
details: async (gameID) => {
|
||||||
mongo.get("embezzle","gamelist",{"gameID":gameID}).then(result => {
|
result = await mongo.get("embezzle","gamelist",{"gameID":gameID})
|
||||||
return (result)
|
return (result)
|
||||||
})
|
|
||||||
},
|
},
|
||||||
register: (name) => {
|
register: (name) => {
|
||||||
id=uuidv4()
|
id=uuidv4()
|
||||||
|
Loading…
Reference in New Issue
Block a user