Custom HTTP/API Routes
Colyseus uses Express as a web server by default.
You may add custom routes to your server by defining them in the initializeExpress
method of your server configuration.
app.config.ts
import config from "@colyseus/tools";
export default config({
// ...
initializeExpress: (app) => {
//
// Define your custom routes here
//
app.get("/hello_world", (req, res) => {
res.json({ hello: "world" });
});
},
// ...
});
For more information about Express, check out the Express guides.
Last updated on