Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. kappacoder
    kappacoder

    kappacoder

    @kappacoder

    Chat Follow Unfollow
    0
    Reputation
    3
    Posts
    527
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with kappacoder
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    kappacoder Follow

    Posts made by kappacoder

    RE: POST method not allowed in express app after passing it to Colyseus constructor

    Oh god, that actually solved it! Thank you very much! I thought I was going crazy :D

    posted in Questions & Help •
    RE: POST method not allowed in express app after passing it to Colyseus constructor

    Hey, still no answer to my issue. If anyone out there has any idea, I'd be really grateful.

    Thanks! :)

    posted in Questions & Help •
    POST method not allowed in express app after passing it to Colyseus constructor

    I am trying to add a POST route to my express app which is also using Colyseus.
    Here is a demo code:

    const app = express();

    // This should add POST in the Allow request headers
    app.use(cors());
    app.options('*', cors());

    // This is the Colyseus implementation
    const gameServer = new Server({
    server: createServer(app)
    });

    app.post('/signup', function (req, res) {
    console.log(req.body);
    console.log(res);
    res.end();
    })

    When I make a POST request using Postman I receive error 405: Method not allowed
    In the headers I see this:
    Allow →GET, HEAD, OPTIONS

    So it seems that POST does not work... When I remove Colyseus and only use the app, the POST requests work.

    Any idea how to fix this, I'd be really grateful.

    posted in Questions & Help •