Bug with the router class
This is my code ``// import the route import { playground } from "@colyseus/playground" // ... const monitor = require("@colyseus/monitor").monitor const express = require("express") const app = express const route = app.Router
// ... route.use("/monitor", monitor)
// bind it as an express middleware route.use("/playground", playground)
app.listen(3000)
which throws this error
$ bun run index.js 478 | end: false 479 | }, fn); 480 | 481 | layer.route = undefined; 482 | 483 | this.stack.push(layer); ^ TypeError: undefined is not an object (evaluating 'this.stack.push') at use (/workspace/colyseus-testing-ground/node_modules/express/lib/router/index.js:483:10) at /workspace/colyseus-testing-ground/index.js:10:7
Bun v1.1.30 (Linux x64) error: script "test" exited with code 1 and the code that throws this error in the /lib/router/index.js line 483 or this.layer.push()
Whats require-triage label?
@evokerking1 The Triage Process indicates that it means further triaging is needed to properly classify the issue.
You wrote const route = app.Router. Is this what's actually in your code? I'd recommend reviewing the docs, which make it clear that you must call Router. That is:
const router = app.Router()
You wrote
const route = app.Router. Is this what's actually in your code? I'd recommend reviewing the docs, which make it clear that you must callRouter. That is:const router = app.Router()
That is all my code.
Hey @evokerking1 :wave:
Like @nwalters512 pointed out, could you please confirm if the issue persists even after changing,
const route = app.Router
to,
const router = app.Router()
Edit:
Also,
const app = express()
Hey @evokerking1 👋
Like @nwalters512 pointed out, could you please confirm if the issue persists even after changing,
const route = app.Routerto,
Agree! this should work
const router = app.Router()