#cargo #server #static #https #single-page

app cargo-server

Helps you serve a static site, single page application or just a static file

2 releases

Uses new Rust 2021

0.2.1 Oct 23, 2022
0.2.0 Oct 23, 2022
0.1.9 Oct 23, 2022
0.1.8 Sep 28, 2022

#205 in Development tools

Download history 89/week @ 2022-09-26 41/week @ 2022-10-03 38/week @ 2022-10-17 54/week @ 2022-10-24 14/week @ 2022-10-31 10/week @ 2022-11-07 1/week @ 2022-11-14

116 downloads per month

MPL-2.0 license

10KB
162 lines

cargo-server

tl;dr: Does the same as "python -m http.server" or "npx serve" but for Rust ecosystem.

cargo-server helps you serve a static site, single page application or just a static file (no matter if on your device or on the local network). It also provides a neat interface for listing the directory's contents.

You can use cargo to install:

$ cargo install cargo-server

With cargo-binstall:

$ cargo binstall cargo-server

Quick example

Once cargo-server is installed, you can run this command inside your project's directory. It will create by default in 8000 port:

$ cargo server

To specify the port, you can use --port:

$ cargo server --port 3000

To open in your browser after run the command just add --open:

$ cargo server --open

You can also set a custom path using --path:

$ cargo server --path /Users/raphamorim/Documents/simple-wasm-frontend-app

Also is possible to run without any stdout using --quiet:

$ cargo server --quiet --open --path /Users/raphamorim/Documents/simple-wasm-frontend-app

Result:

Demo

Dependencies

~8–15MB
~249K SLoC