#live #server #web

bin+lib live-server

Launch a local network server with live reload feature for static pages

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

Download history 28/week @ 2023-02-10 30/week @ 2023-02-17 22/week @ 2023-02-24 6/week @ 2023-03-03 55/week @ 2023-03-10 13/week @ 2023-03-17 4/week @ 2023-03-24 9/week @ 2023-03-31 25/week @ 2023-04-07 18/week @ 2023-04-14 6/week @ 2023-04-21 26/week @ 2023-04-28 52/week @ 2023-05-05 13/week @ 2023-05-12 11/week @ 2023-05-19 38/week @ 2023-05-26

116 downloads per month
Used in docki

MIT license

22KB
234 lines

crate-badge License check-badge

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