New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change how we figure out which directory should be served as static #62
Comments
@jacobwod this sounds reasonable. Are you up for submitting a PR? |
Absolutely. But you are aware of that the implication of this is that the process must be launched from a directory that actually contains jw@abc ~ % node test.js
process.cwd() is /Users/jw
jw@abc ~ % cd dev
jw@abc dev % node ../test.js
process.cwd() is /Users/jw/dev I think it's better, given how this generator is constructed (and I've implemented the change in my project as I found it more useful) - but it does changes the current behaviour. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently we use
__dirname
(which returns the path ofserver.js
) as starting point in finding our way to/public
.generator-express-no-stress/app/templates/server/common/server.js
Line 17 in 53082f9
generator-express-no-stress/app/templates/server/common/server.js
Line 30 in 53082f9
There are two issues with this scenario:
/dist
,/public
is just one directory up fromserver.js
, not two)I propose a solution that uses
process.cwd()
instead. Given that we launch the process from/
, it's an easy task to find/public
:This works well both with in dev and production and is OS-agnostic as we compile the path using
path.join()
. Furthermore, in combination with #61, theconst root
can be entirely removed as it's not used anymore.Let me know if I should prepare the PR for this one too.
The text was updated successfully, but these errors were encountered: