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

HTTP-server: Add '/list' endpoint #191

Merged
merged 7 commits into from
Jul 3, 2024
Merged

Conversation

nytamin
Copy link
Contributor

@nytamin nytamin commented Jul 2, 2024

About Me

This pull request is posted on behalf of the NRK

Type of Contribution

This is a:

Feature

Current Behavior

The only way to see which files are hosted by http-server is the JSON exposed at /packages

New Behavior

New page at /list which displays a list of the files in a user(-ish) friendly way.

image

Testing Instructions

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@nytamin nytamin requested a review from jstarpl July 2, 2024 10:56
Copy link
Member

@jstarpl jstarpl left a comment

Choose a reason for hiding this comment

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

I think it's a bit weird that listPackages both has a side-effect and returns a value, but I suppose that makes it simpler.

I think however that it would be helpful if the href's in the HTML page would be relative, since that will be easier on reverse-proxies (if any) in front of PM HTTP server.

apps/http-server/packages/generic/src/server.ts Outdated Show resolved Hide resolved
apps/http-server/packages/generic/src/lib.ts Outdated Show resolved Hide resolved
@nytamin nytamin changed the title Improve the info message at '/' and refactor HTTP-server: Add '/list' endpoint Jul 3, 2024
@nytamin
Copy link
Contributor Author

nytamin commented Jul 3, 2024

I think it's a bit weird that listPackages both has a side-effect and returns a value, but I suppose that makes it simpler.

Agreed, it became quite hard to understand what's happening..

I've refactored the http-server now so that the Storage/FileStorage class doesn't modify ctx as a side effect, but instead returns the values, to be used by the server.

@nytamin nytamin requested a review from jstarpl July 3, 2024 09:48
Copy link
Member

@jstarpl jstarpl left a comment

Choose a reason for hiding this comment

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

Yes, this is much cleaner now!

Just some minor naming feedback, and a question if we really need packageVersion.ts to be committed to the repo.

apps/http-server/packages/generic/src/packageVersion.ts Outdated Show resolved Hide resolved
apps/http-server/packages/generic/src/storage/storage.ts Outdated Show resolved Hide resolved
@nytamin nytamin merged commit 09691ec into master Jul 3, 2024
11 checks passed
@nytamin nytamin deleted the fix/http-server-html-list branch July 3, 2024 11:58
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.

2 participants