-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: read static files from the public folder #29
Conversation
The documentation is still pending. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks for the review @gzurl ! I'm going to add the missing use case of allowing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
You could add this later, but I think a simple example worker that uses static assets will help the adoption of this feature.
IDK, for example something simple that creates a business card with some background image based on a call to make-business-card.js?first_name=John&last_name=Doe&phone=123345...
@gzurl @assambar @ereslibre I completed the feature by adding support for static HTML files. Now, the
This is an interesting use case. It can work for OpenGraph images and business cards (as you suggested). I will give a second though to that idea and will implement some examples around. However, those will work purely with workers, so I don't think static assets will be used that much in the example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking fantastic; thanks @Angelmmiguel! LGTM. A minor optional comment.
Support static files by reading them from the
public
folder in the root of the project. Any file inside this folder will be served as a static file, so project like static sites can work without embedding files in the workers. This is a pretty consistent standard in different web frameworks like:Note that the
public
folder based on the given path in the CLI. So, forwws ./examples
, the CLI will serve the files from./examples/public
. There's an issue with path management aswws ./examples
should calculate the routes without including theexamples
folder. This issue will be solved in #3.It closes #7