dev_bestia_simple_server
simple server from github.com/steveklabnik/simple-server
version: 2021.918.1640 date: 2021-09-18 author: bestia.dev repository: GitHub
Hashtags: #rustlang #server #web
My projects on Github are more like a tutorial than a finished product: bestia-dev tutorials.
I want the simplest web server ever. It will be used exclusively locally from one super simple web-application, so don't need to care much about security. I choose simple server from the rust book. I don't care about multi-threading or async , because it will be used by only one browser. The example from the book evolved into the github repository of the author of the book github.com/steveklabnik.
I cloned it, updated the dependencies and consequently fixed some broken code.
I had to publish it to crates.io because the project cargo_crev_reviews use it. Crates.io does not accept local path
dependencies, only crates.io dependencies.
A simple web-server
The simple-server
crate is designed to give you the tools to to build
an HTTP server, based around the http crate, blocking I/O, and a
threadpool.
We call it 'simple' want to keep the code small, and easy to understand. This is why we're only using blocking I/O. Depending on your needs, you may or may not want to choose another server. However, just the simple stuff is often enough for many projects.
Examples
At its core, simple-server
contains a Server
. The Server
is
passed a handler upon creation, and the listen
method is used
to start handling connections.
The other types are from the http
crate, and give you the ability
to work with various aspects of HTTP. The Request
, Response
, and
ResponseBuilder
types are used by the handler you give to Server
,
for example.
To see examples of this crate in use, please consult the examples
directory.
Open-source and free as a beer
My open-source projects are free as a beer (MIT license).
I just love programming.
But I need also to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my PayPal.
You know the price of a beer in your local bar ;-)
So I can drink a free beer for your health :-)
Na zdravje! Alla salute! Prost! Nazdravlje!
//bestia.dev
//github.com/bestia-dev
//bestiadev.substack.com
//youtube.com/@bestia-dev-tutorials