Skip to content

A small Rust utility to create a binary embedding a static website/webapp and a webserver to serve it.

Notifications You must be signed in to change notification settings

DuredhelFinceleb/embedded_files_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedded Files Server in Rust

A small utility to create a binary embedding a static website/webapp and a webserver to serve it.

Useful for example if you need to run a webapp on any machine without having to copy the files & setup a webserver.

Instead, just copy the binary and launch your browser.

The server is always launched on localhost.

By default, it listens on port 3000. This can be changed at runtime using the '--port' command line argument. This means you can run multiple instances of the same website/webapp.

Under the hood it uses:

Compiled with:

  • rust 1.56.1
  • rocket 0.5.0-rc.1

Tested with

  • Ubuntu 20.04
  • WSL running Ubuntu 20.04
  • Windows 10 Pro 21H1 (note: if it does not compile crashing on mio 0.7.14, run 'cargo update' & try again)

How to install

Clone this repo.

Then define the EMBEDDED_FILES_PATH environment variable with the path to the folder to embed:

export EMBEDDED_FILES_PATH=<path_to_folder_to_embed>

Then

cargo build --release

The binary will be 'target/release/embedded_files_server'. It can be renamed and moved freely. Just run it.

The '--port' command line argument will be accepted to change the port from the default 3000.

Note that if you don't want/need the binary, you can just do a 'cargo run' instead.

About

A small Rust utility to create a binary embedding a static website/webapp and a webserver to serve it.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published