Crate shrimple_localhost
source ·Expand description
Zero-dependency simple synchronous localhost server. The 2 ways to use the library are:
serve_current_dir
,serve
,serve_current_dir_at
,serve_at
functions, the simpler approach.Server
struct, the more complex approach. 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§
- Data associated with a successful request.
- Server for serving files locally
Enums§
- The result of a request. This doesn’t report IO errors, since in a case of such error no request is registered.
- 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§
- 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 files from
root
at portServer::DEFAULT_PORT
- Serve files from
root
ataddr
- Serve files from the current directory at port
Server::DEFAULT_PORT
- Serve files from
root
at portServer::DEFAULT_PORT