Skip to content

Commit f62c876

Browse files
committed
Add index and view routes again
1 parent f67f62d commit f62c876

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

server.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ app.use(cors({
2929
allowedHeaders: ["Content-Type", "Authorization"],
3030
}));
3131

32+
app.get("/", (req, res) => {
33+
res.sendFile(join(__dirname, "dist", "index.html"));
34+
});
35+
36+
app.get("/view/:docId", (req, res) => {
37+
const docId = req.params.docId;
38+
39+
if (!docId) {
40+
return res.status(400).send("Fehlende Dokument-ID");
41+
}
42+
43+
// Cookie mit der docId setzen (Gültigkeit: 1 Tag)
44+
res.cookie("docId", docId, {
45+
maxAge: 24 * 60 * 60 * 1000,
46+
httpOnly: true,
47+
sameSite: "none",
48+
secure: "false"
49+
});
50+
51+
res.sendFile(join(__dirname, "dist", "view.html"));
52+
});
53+
3254
app.get("/download/:docId", async (req, res) => {
3355
const {docId} = req.params;
3456
const filePath = join(__dirname, UPLOAD_DIR, `${docId}.bin`);

0 commit comments

Comments
 (0)