Skip to content

Commit

Permalink
fix(webapp): remove next page from api server
Browse files Browse the repository at this point in the history
  • Loading branch information
ben196888 committed Jun 8, 2024
1 parent a6d6789 commit 4640d2c
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions packages/webapp/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { Server, Origins } from "boardgame.io/server";
import next from 'next';
import url from "url";
import { OpenStarTerVillage } from "./game";

async function serve() {
const port = Number(process.env.PORT) || 8000;
const apiPort = Number(process.env.API_PORT) || 8080;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();

const server = Server({
games: [OpenStarTerVillage],
Expand All @@ -26,17 +21,9 @@ async function serve() {
apiCallback: () => console.log(`Lobby api running on port ${apiPort}`),
};

await app.prepare();
server.run({
...mainServerConfig,
lobbyConfig,
}, () => {
server.app.use(async (ctx, next) => {
const parsedUrl = url.parse(ctx.req.url!, true);
await handle(ctx.req, ctx.res, parsedUrl);
ctx.respond = false;
await next();
});
});
}

Expand Down

0 comments on commit 4640d2c

Please sign in to comment.