Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Add TODOs for Express security & best practices #5

Merged
merged 1 commit into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@remix-run/node": "^2.9.1",
"@remix-run/react": "^2.9.1",
"aws-cdk-lib": "2.140.0",
"compression": "^1.7.4",
"constructs": "^10.0.0",
"cross-env": "^7.0.3",
"express": "^4.19.2",
Expand Down
10 changes: 8 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { createRequestHandler } from "@remix-run/express";
import express from "express";
import compression from "compression";
// TODO: add protection with helmet (see https://github.com/dev-xo/remix-saas/blob/main/server.mjs)
// TODO: add rate limiting (see https://github.com/dev-xo/remix-saas/blob/main/server.mjs)
// TODO: add CSRF and honeypot protection (see https://github.com/dev-xo/remix-saas/blob/main/server.mjs)

const viteDevServer =
process.env.NODE_ENV === "production"
? null
: await import("vite").then((vite) =>
vite.createServer({
server: { middlewareMode: true },
}),
})
);

const app = express();
Expand All @@ -18,8 +22,10 @@ const app = express();
*/
app.disable("x-powered-by");

app.use(compression());

app.use(
viteDevServer ? viteDevServer.middlewares : express.static("build/client"),
viteDevServer ? viteDevServer.middlewares : express.static("build/client")
);

const build = viteDevServer
Expand Down
Loading