mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 02:19:08 +00:00
finish MVP
This commit is contained in:
parent
7806219464
commit
eaa1167f16
22 changed files with 486 additions and 116 deletions
|
@ -8,6 +8,15 @@ const _io = require('socket.io')
|
|||
const router = require('koa-better-router')().loadMethods()
|
||||
const Roleypoly = require('./Roleypoly')
|
||||
|
||||
// monkey patch async-reduce because F U T U R E
|
||||
Array.prototype.areduce = async function (predicate, acc = []) { // eslint-disable-line
|
||||
for (let i of this) {
|
||||
acc = await predicate(acc, i)
|
||||
}
|
||||
|
||||
return acc
|
||||
}
|
||||
|
||||
// Create the server and socket.io server
|
||||
const server = http.createServer(app.callback())
|
||||
const io = _io(server, { transports: ['websocket'], path: '/api/socket.io', wsEngine: 'uws' })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue