Skip to content
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

Use consistent root for serving admin #588

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dkarnutsch
Copy link
Contributor

@dkarnutsch dkarnutsch commented Dec 4, 2024

Currently it makes a difference from which directory the server is called.

This works

➜  ~/ws/comet-starter/admin/server git:(main) ✗ APP_PORT=3001 node index.js       
Current working directory: /Users/danielkarnutsch/ws/comet-starter/admin/server
Admin app listening at http://localhost:3001

while this is not working:

➜  ~/ws/comet-starter/admin git:(main) ✗ APP_PORT=3001 node server/index.js
Current working directory: /Users/danielkarnutsch/ws/comet-starter/admin
node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '../build/index.html'

With this PR the admin is always served relative to the location of server.js. Furthermore server.js was renamed to index.js to make it possible to run the server using node server instead of using node server/server.js.

See also #388 (comment)

@nsams
Copy link
Member

nsams commented Dec 4, 2024

yes, it is strange that the server serves cwd/../build

wouldn't it make more sense to serve cwd or cwd/build?

Copy link
Collaborator

@johnnyomair johnnyomair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it make more sense to serve cwd or cwd/build?

I'd also do this.

@dkarnutsch
Copy link
Contributor Author

@johnnyomair @nsams done.

Now npm run serve (called from ./admin) and node server (called from ./admin) works.

Copy link

sonarqubecloud bot commented Jan 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants