Complete production setup with Express server
Some checks failed
CI/CD / Test (push) Has been cancelled
CI/CD / Docker Build Validation (push) Has been cancelled
Docker Publish / docker-build-publish (push) Has been cancelled
Code Quality / Quality Analysis (push) Has been cancelled
Code Quality / Accessibility Tests (push) Has been cancelled
Code Quality / Performance Audit (push) Has been cancelled
Code Quality / PR Size Check (push) Has been cancelled
Security Analysis / CodeQL Analysis (javascript) (push) Has been cancelled
Security Analysis / CodeQL Analysis (typescript) (push) Has been cancelled
Security Analysis / Dependency Vulnerability Scan (push) Has been cancelled
Security Analysis / Secrets Detection (push) Has been cancelled
Update Stable Branch / prepare-release (push) Has been cancelled
Mark Stale Issues and Pull Requests / stale (push) Has been cancelled
Some checks failed
CI/CD / Test (push) Has been cancelled
CI/CD / Docker Build Validation (push) Has been cancelled
Docker Publish / docker-build-publish (push) Has been cancelled
Code Quality / Quality Analysis (push) Has been cancelled
Code Quality / Accessibility Tests (push) Has been cancelled
Code Quality / Performance Audit (push) Has been cancelled
Code Quality / PR Size Check (push) Has been cancelled
Security Analysis / CodeQL Analysis (javascript) (push) Has been cancelled
Security Analysis / CodeQL Analysis (typescript) (push) Has been cancelled
Security Analysis / Dependency Vulnerability Scan (push) Has been cancelled
Security Analysis / Secrets Detection (push) Has been cancelled
Update Stable Branch / prepare-release (push) Has been cancelled
Mark Stale Issues and Pull Requests / stale (push) Has been cancelled
This commit is contained in:
40
server.mjs
Normal file
40
server.mjs
Normal file
@@ -0,0 +1,40 @@
|
||||
import { createRequestHandler } from "@remix-run/express";
|
||||
import { installGlobals } from "@remix-run/node";
|
||||
import compression from "compression";
|
||||
import express from "express";
|
||||
import morgan from "morgan";
|
||||
import { fileURLToPath } from "url";
|
||||
import { dirname, join } from "path";
|
||||
|
||||
installGlobals();
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const BUILD_PATH = join(__dirname, "build", "server", "index.js");
|
||||
const PUBLIC_PATH = join(__dirname, "build", "client");
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(compression());
|
||||
app.disable("x-powered-by");
|
||||
app.use(morgan("tiny"));
|
||||
|
||||
app.use(
|
||||
express.static(PUBLIC_PATH, {
|
||||
maxAge: "1h",
|
||||
immutable: true,
|
||||
})
|
||||
);
|
||||
|
||||
app.all(
|
||||
"*",
|
||||
createRequestHandler({
|
||||
build: await import(BUILD_PATH),
|
||||
})
|
||||
);
|
||||
|
||||
const port = process.env.PORT || 8788;
|
||||
app.listen(port, "0.0.0.0", () => {
|
||||
console.log(`Express server listening on port ${port}`);
|
||||
});
|
||||
Reference in New Issue
Block a user