#server #local-server #localhost #dev-tools

bin+lib shrimple-localhost

Zero-dependency localhost server, usable both in the terminal and in your Rust code

8 releases (4 major breaking)

5.2.0 Sep 21, 2024
5.1.0 Sep 20, 2024
5.0.0 Aug 19, 2024
4.0.0 May 5, 2024
1.0.0 Apr 28, 2024

#489 in Development tools

Download history 82/week @ 2024-08-13 51/week @ 2024-08-20 4/week @ 2024-08-27 13/week @ 2024-09-10 310/week @ 2024-09-17 32/week @ 2024-09-24 37/week @ 2024-10-01 9/week @ 2024-10-08

387 downloads per month
Used in shrimple

MIT license

44KB
894 lines

serve_current_dir()

Host your local files, e.g. for inspection by tools such as your trusty browser:

  • On any platform,
  • Without any additional dependencies,
  • Without even executing any shell commands!

Installation

Need it as a CLI?

cargo install shrimple-localhost

Need it as a library?

cargo add shrimple-localhost

Usage

CLI

Without any options, shrimple-localhost defaults to hosting the files in the current directory at the default port

shrimple-localhost
  • To specify a custom root, provide the -r flag followed by the path to the root
  • To specify a custom port, provide the -p flag followed by the port number
shrimple-localhost -p 4096 -r ~/website/static

Library

More on this in the docs of the library: https://docs.rs/shrimple-localhost

Limitations

The server to be made lightweight, thus it's very barebones; it can only handle 1 connection at once, which should be enough for what's merely a development tool.

No runtime deps