diff --git a/Dockerfile b/Dockerfile index 76b7676..8942118 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,6 +41,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/server.js ./server.js USER nextjs @@ -48,4 +49,4 @@ EXPOSE 3000 ENV PORT 3000 -CMD ["npm", "start"] +CMD ["node", "server.js"] diff --git a/server.js b/server.js index 705249d..bdde3ee 100644 --- a/server.js +++ b/server.js @@ -25,7 +25,17 @@ const handler = app.getRequestHandler(); const nextUpgradeHandler = app.getUpgradeHandler(); app.prepare().then(() => { - const httpServer = createServer(handler); + const httpServer = createServer((req, res) => { + const parsedUrl = parse(req.url, true); + const { pathname } = parsedUrl; + + // Custom route for /resourcing + if (pathname.startsWith('/resourcing')) { + app.render(req, res, '/', parsedUrl.query); + } else { + handler(req, res, parsedUrl); + } + }); httpServer .once('error', (err) => {