Crate shrimple_localhost

Source
Expand description

Zero-dependency simple synchronous localhost server. The 2 ways to use the library are:

If inspecting incoming connections & requests is needed (e.g. for logging), the 2nd approach will be better, otherwise the 1st one will be easier.

Structs§

Request
Data associated with a successful request.
Server
Server for serving files locally

Enums§

RequestResult
The result of a request. This doesn’t report IO errors, since in a case of such error no request is registered.
Response
Server’s response to a request.
ServerError
Error returned by Server::try_serve_with_callback that differentiates between an IO error from within the server and an error propagated from a callback.

Functions§

print_request_result
Default function for printing the result of a request along with the IP from which it came. Can be passed to Server::serve_with_callback.
serve
Serve files from root at port Server::DEFAULT_PORT
serve_at
Serve files from root at addr
serve_current_dir
Serve files from the current directory at port Server::DEFAULT_PORT
serve_current_dir_at
Serve files from root at port Server::DEFAULT_PORT