fix: use root option in sendFile to avoid dotfile 500 on SPA refresh
When served via npx, the absolute path to index.html traverses .npm, triggering Express 5 / send's dotfile guard. Using the root option makes send only check the relative filename for dotfiles. Fixes #48
This commit is contained in:
parent
7cb46d97f6
commit
264d40e6ca
1 changed files with 1 additions and 1 deletions
|
|
@ -133,7 +133,7 @@ export async function createApp(
|
||||||
if (uiDist) {
|
if (uiDist) {
|
||||||
app.use(express.static(uiDist));
|
app.use(express.static(uiDist));
|
||||||
app.get(/.*/, (_req, res) => {
|
app.get(/.*/, (_req, res) => {
|
||||||
res.sendFile(path.join(uiDist, "index.html"));
|
res.sendFile("index.html", { root: uiDist });
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.warn("[paperclip] UI dist not found; running in API-only mode");
|
console.warn("[paperclip] UI dist not found; running in API-only mode");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue