diff --git a/packages/webapp/package.json b/packages/webapp/package.json index b69db312..134f1c58 100644 --- a/packages/webapp/package.json +++ b/packages/webapp/package.json @@ -9,7 +9,7 @@ "build": "yarn build:next && yarn build:server", "build:next": "next build", "build:server": "tsc -P tsconfig.server.json", - "start": "yarn start:next && yarn start:server", + "start": "yarn start:next & yarn start:server", "start:next": "next start", "start:server": "node dist/server.js", "lint": "next lint", diff --git a/packages/webapp/src/server.ts b/packages/webapp/src/server.ts index 5016057f..64bb90a7 100644 --- a/packages/webapp/src/server.ts +++ b/packages/webapp/src/server.ts @@ -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], @@ -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(); - }); }); }