nickel-org / nickel.rs

An expressjs inspired web framework for Rust

Home Page:http://nickel-org.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StaticFilesHandler from binary resource

imclint21 opened this issue · comments

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

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

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

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.

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

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

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

Np @jolhoeft, maybe you have Telegram or other ?

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

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

What is your discord ?

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

I am jolhoeft#3868 in Discord, btw.

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!