@jcbuisson/express-x 1.7.6 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server.mjs +7 -2
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -10,6 +10,9 @@ export function expressX(prisma, config) {
|
|
|
10
10
|
|
|
11
11
|
const app = express()
|
|
12
12
|
|
|
13
|
+
// so that config can be accessed anywhere with app.get('config')
|
|
14
|
+
app.set('config', config)
|
|
15
|
+
|
|
13
16
|
// websocket transport by default
|
|
14
17
|
if (config.WS_TRANSPORT == undefined) config.WS_TRANSPORT = true
|
|
15
18
|
|
|
@@ -316,7 +319,10 @@ export function expressX(prisma, config) {
|
|
|
316
319
|
/*
|
|
317
320
|
* Add websocket transport
|
|
318
321
|
*/
|
|
319
|
-
const io = new Server(server
|
|
322
|
+
const io = new Server(server, {
|
|
323
|
+
path: config.WS_PATH || '/expressx-socket-io',
|
|
324
|
+
})
|
|
325
|
+
|
|
320
326
|
|
|
321
327
|
io.on('connection', async function(socket) {
|
|
322
328
|
const clientIP = socket.request?.connection?.remoteAddress || 'unknown'
|
|
@@ -456,7 +462,6 @@ export function expressX(prisma, config) {
|
|
|
456
462
|
// enhance `app` with objects and methods
|
|
457
463
|
return Object.assign(app, {
|
|
458
464
|
prisma,
|
|
459
|
-
config,
|
|
460
465
|
getSocket, setSocket,
|
|
461
466
|
createDatabaseService,
|
|
462
467
|
createService,
|