https://github.com/njfdev/custom-rust-http-server
A simple HTTP server built in Rust.
https://github.com/njfdev/custom-rust-http-server
Last synced: over 1 year ago
JSON representation
A simple HTTP server built in Rust.
- Host: GitHub
- URL: https://github.com/njfdev/custom-rust-http-server
- Owner: njfdev
- Created: 2024-07-05T16:18:04.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-05T19:51:30.000Z (almost 2 years ago)
- Last Synced: 2025-01-27T06:13:41.999Z (over 1 year ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Custom Rust HTTP Server
This is the repository for a custom HTTP server written in Rust. It is developed with CodeCrafters, but is still my original code.
## Running
Just run this command and a webserver will start on port 4221.
```bash
./your_server.sh
```
## Capabilities
You can go to the index page which returns nothing. You can also go to `/echo/type_whatever_here` and it will return whatever you typed. The `/user-agent` page will return your User-Agent header. If you pass a `--directory ` argument, the `/files/` path will return any file specified in that directory. If you send a `POST` request to a `/files/` path with a body, a new file will be created there. Any other page will return a 404 error code.
The server has a very basic multithreading capability, where it will start a new thread for every request. If the HTTP client accepts a gzip encoding, the server will encode the content with gzip.