10 releases (5 breaking)
0.6.0 | Mar 1, 2023 |
---|---|
0.5.0 | Sep 13, 2022 |
0.4.2 | Aug 17, 2022 |
0.4.1 | Jul 7, 2022 |
0.1.1 | Jan 16, 2022 |
#2260 in Network programming
116 downloads per month
Used in docki
22KB
234 lines
Live Server
Launch a local network server with live reload feature for static pages.
Binary
You can use it as a CLI program.
Install
$ cargo install live-server
Usage
$ live-server --help
live-server 0.6.0
Launch a local network server with live reload feature for static pages
USAGE:
live-server [OPTIONS] [PATH]
ARGS:
<PATH> Set the path of the static assets [default: .]
OPTIONS:
-h, --host <HOST> Set the listener host [default: LAN IP address]
--help Print help information
-p, --port <PORT> Set the listener port [default: 8000]
-V, --version Print version information
Log Level
You can set different RUST_LOG
environment variable to filter the log. The default log level is warn
. So if you want to get more detailed information, it is recommended to use:
$ RUST_LOG=debug,tide=warn live-server
[2023-02-17T09:18:56Z INFO live_server::server] Listening on http://192.168.0.166:8000/
[2023-02-17T09:18:56Z INFO live_server::watcher] Listening on /tmp/live_server_test/
[2023-02-17T09:19:06Z DEBUG live_server::watcher] [UPDATE] index.html
Package
You can also import it as a library in your project.
Create live server
use live_server::listen;
listen("127.0.0.1", 8080, "./").await.unwrap();
Enable logs (Optional)
env_logger::init();
Dependencies
~11–19MB
~370K SLoC