<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[POST method not allowed in express app after passing it to Colyseus constructor]]></title><description><![CDATA[<p>I am trying to add a POST route to my express app which is also using Colyseus.<br />
Here is a demo code:</p>
<p>const app = express();</p>
<p>// This should add POST in the Allow request headers<br />
app.use(cors());<br />
app.options('*', cors());</p>
<p>// This is the Colyseus implementation<br />
const gameServer = new Server({<br />
server: createServer(app)<br />
});</p>
<p>app.post('/signup', function (req, res) {<br />
console.log(req.body);<br />
console.log(res);<br />
res.end();<br />
})</p>
<p>When I make a POST request using Postman I receive error 405: Method not allowed<br />
In the headers I see this:<br />
Allow →GET, HEAD, OPTIONS</p>
<p>So it seems that POST does not work... When I remove Colyseus and only use the app, the POST requests work.</p>
<p>Any idea how to fix this, I'd be really grateful.</p>
]]></description><link>http://discuss.colyseus.io/topic/225/post-method-not-allowed-in-express-app-after-passing-it-to-colyseus-constructor</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 08:36:43 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/225.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Mar 2019 15:15:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to POST method not allowed in express app after passing it to Colyseus constructor on Invalid Date]]></title><description><![CDATA[<p>I am trying to add a POST route to my express app which is also using Colyseus.<br />
Here is a demo code:</p>
<p>const app = express();</p>
<p>// This should add POST in the Allow request headers<br />
app.use(cors());<br />
app.options('*', cors());</p>
<p>// This is the Colyseus implementation<br />
const gameServer = new Server({<br />
server: createServer(app)<br />
});</p>
<p>app.post('/signup', function (req, res) {<br />
console.log(req.body);<br />
console.log(res);<br />
res.end();<br />
})</p>
<p>When I make a POST request using Postman I receive error 405: Method not allowed<br />
In the headers I see this:<br />
Allow →GET, HEAD, OPTIONS</p>
<p>So it seems that POST does not work... When I remove Colyseus and only use the app, the POST requests work.</p>
<p>Any idea how to fix this, I'd be really grateful.</p>
]]></description><link>http://discuss.colyseus.io/post/751</link><guid isPermaLink="true">http://discuss.colyseus.io/post/751</guid><dc:creator><![CDATA[kappacoder]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to POST method not allowed in express app after passing it to Colyseus constructor on Invalid Date]]></title><description><![CDATA[<p>Hey, still no answer to my issue. If anyone out there has any idea, I'd be really grateful.</p>
<p>Thanks! :)</p>
]]></description><link>http://discuss.colyseus.io/post/756</link><guid isPermaLink="true">http://discuss.colyseus.io/post/756</guid><dc:creator><![CDATA[kappacoder]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to POST method not allowed in express app after passing it to Colyseus constructor on Thu, 21 Mar 2019 19:34:25 GMT]]></title><description><![CDATA[<p>Try reordering the declarations. ie</p>
<p>app.post('/signup', function (req, res) {<br />
console.log(req.body);<br />
console.log(res);<br />
res.end();<br />
})</p>
<p>// This is the Colyseus implementation<br />
const gameServer = new Server({<br />
server: createServer(app)<br />
});</p>
<p>As far as I know express will process the hooks in the order they are declared so if colyseus is acting like a catch-all nothing after it will be processed. I am doing the same thing and I have all my HTTP handlers declared before the colyseus implementation.</p>
]]></description><link>http://discuss.colyseus.io/post/757</link><guid isPermaLink="true">http://discuss.colyseus.io/post/757</guid><dc:creator><![CDATA[bamsutler]]></dc:creator><pubDate>Thu, 21 Mar 2019 19:34:25 GMT</pubDate></item><item><title><![CDATA[Reply to POST method not allowed in express app after passing it to Colyseus constructor on Invalid Date]]></title><description><![CDATA[<p>Oh god, that actually solved it! Thank you very much! I thought I was going crazy :D</p>
]]></description><link>http://discuss.colyseus.io/post/760</link><guid isPermaLink="true">http://discuss.colyseus.io/post/760</guid><dc:creator><![CDATA[kappacoder]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to POST method not allowed in express app after passing it to Colyseus constructor on Invalid Date]]></title><description><![CDATA[<p>Hello! I've run into the same issue, but as I want run my server on Colyseus Arena I can't define handlers directly before server. According to <a href="https://docs.colyseus.io/arena/getting-started/modify-colyseus-server/" rel="nofollow">https://docs.colyseus.io/arena/getting-started/modify-colyseus-server/</a> I need to use arena.config.ts. Where, by design, I can manipulate expres app only after the server is created</p>
<p>Is there any way to add POST to allowed methods with this configuration? Or may be it is better to move to self-hosted option?</p>
]]></description><link>http://discuss.colyseus.io/post/2278</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2278</guid><dc:creator><![CDATA[kpded]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>