share links

This commit is contained in:
Milo Schwartz 2024-12-20 22:24:44 -05:00
parent 72dc02ff2e
commit 845d65ad33
No known key found for this signature in database
31 changed files with 1281 additions and 212 deletions

View file

@ -7,23 +7,25 @@ import config from "@server/config";
const nextPort = config.server.next_port;
export async function createNextServer() {
// const app = next({ dev });
const app = next({ dev: process.env.ENVIRONMENT !== "prod" });
const handle = app.getRequestHandler();
// const app = next({ dev });
const app = next({ dev: process.env.ENVIRONMENT !== "prod" });
const handle = app.getRequestHandler();
await app.prepare();
await app.prepare();
const nextServer = express();
const nextServer = express();
nextServer.all("*", (req, res) => {
const parsedUrl = parse(req.url!, true);
return handle(req, res, parsedUrl);
});
nextServer.all("*", (req, res) => {
const parsedUrl = parse(req.url!, true);
return handle(req, res, parsedUrl);
});
nextServer.listen(nextPort, (err?: any) => {
if (err) throw err;
logger.info(`Next.js server is running on http://localhost:${nextPort}`);
});
nextServer.listen(nextPort, (err?: any) => {
if (err) throw err;
logger.info(
`Next.js server is running on http://localhost:${nextPort}`
);
});
return nextServer;
return nextServer;
}