You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.
Reading through some other issues on the repo it seems like this should have worked:
app.use(express.static('./public'));
However, I am finding that this attempts to serve the public folder in the directory the executable is run from. The workaround I am using for this is incredibly hacky:
import { URL } from 'url';
const __dirname = new URL('.', import.meta.url).pathname;
app.use(express.static(path.join(__dirname.slice(1), './public')));
This now behaves as I expected and serves the public folder that was packed into the executable.
Is there a more sane way to do this or a way to better understand why express isn't playing nice with caxa?
The text was updated successfully, but these errors were encountered:
Thanks for considering using caxa. Perhaps there could be more elegant ways of expressing this idea, but I think that the proper solution to the issue that you bring up really is to make the path relative to the source file, instead of relative to the working directory from which your server was run. This isn’t necessary a concern having to do with caxa—the same issue would arise if you ran your server from a different directory: node path-to-application/index.mjs.
In any case, I’ve been thinking about the broad strategy employed by caxa and concluded that there is a better way to solve the problem.
It’s a different enough approach that I think it deserves a new name, and it’s part of a bigger toolset that I’m building, which I call Radically Straightforward · Package.
Reading through some other issues on the repo it seems like this should have worked:
However, I am finding that this attempts to serve the public folder in the directory the executable is run from. The workaround I am using for this is incredibly hacky:
This now behaves as I expected and serves the public folder that was packed into the executable.
Is there a more sane way to do this or a way to better understand why express isn't playing nice with caxa?
The text was updated successfully, but these errors were encountered: