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

StaticFilesHandler from binary resource #441

Open
imclint21 opened this issue Aug 19, 2019 · 12 comments
Open

StaticFilesHandler from binary resource #441

imclint21 opened this issue Aug 19, 2019 · 12 comments

Comments

@imclint21
Copy link

Hey,

In the goal to publish a binary that can include a web page, I try to use StaticFilesHandler with included resources files, do you think there are an easy way to achieve this ?

Cheers

@jolhoeft
Copy link
Member

I'm not sure I understand. Simply serving up static files should be straightforward. The static_files.rs example shows how.

@imclint21
Copy link
Author

imclint21 commented Aug 21, 2019

Yes but I would like to pack the assets into the compiled binary, do you understand what I mean ?

Ha this is interesting: https://github.com/pyros2097/rust-embed

@jolhoeft
Copy link
Member

Ah, I see. I don't think the static files handler will quite do it, using that crate or just the include_str/include_bytes macros. It basically looks to the filesystem, and data embedded in the executable doesn't show up in the filesystem.

For a small number of items some handwritten middleware wouldn't be too much trouble. An EmbeddedData might be worth creating for larger numbers. I'll ponder a bit. It might be basically StaticFilesHandler, but derive rust-embed instead of looking at the filesystem would implement the RustEmbed trait and use get to retrieve the data. Not quite sure it can be done w/o writing a procedural macro, though. I've not done that before.

@imclint21
Copy link
Author

imclint21 commented Aug 22, 2019

It would be great to add this feature, I think rust is very good to make portable binaries and this feature can help this ^^

@imclint21
Copy link
Author

Hey @jolhoeft do you have news about it ? :D

@jolhoeft
Copy link
Member

Sorry, I've been swamped by work. It's on my todo list.

@imclint21
Copy link
Author

Np @jolhoeft, maybe you have Telegram or other ?

@jolhoeft
Copy link
Member

I'm not on Telegram, I am on Discord and Google chat. There is also Nickel's gitter channel.

@imclint21
Copy link
Author

Hmm, okey, btw Telegram is a very cool app :D

What is your discord ?

@jolhoeft
Copy link
Member

Are you no longer interested in this feature? I was hoping to work on it this weekend.

@jolhoeft jolhoeft reopened this Oct 19, 2019
@jolhoeft
Copy link
Member

I am jolhoeft#3868 in Discord, btw.

@imclint21
Copy link
Author

Are you no longer interested in this feature? I was hoping to work on it this weekend.

I'm interested, I think its an important feature!

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

No branches or pull requests

2 participants