Crab Http
This is a fast and lightweight (less than 2 MB) HTTP server written in Rust 🦀
Usage
-
Installation
cargo install crab-http- Download the binary from github releases.
- Run the following command to start the server:
crab-http
Note: Make sure that port 8080 is not in use. You can change the port by using the --port flag.
3. Make your first request:
- Run
for more options.
Building from source:
- Make sure you have 🦀 Rust installed. You can install it from rustup.rs.
- Clone the repository:
- Change to the directory:
- Build the project:
- Run the server 🚀:
Features
-
Port, directory, and write access configuration through command line arguments.
-
File serving: You can access any file in the specified directory using the URL
http://localhost:8080/files/<filename>. -
File Creation: You can create a file by sending a POST request with the file content to the URL
http://localhost:8080/files/<filename>. The server will create a file with the specified name in the specified directory. -
File Updation: You can update a file by sending a POST request with the new content to the URL
http://localhost:8080/files/<filename>. The server will update the file with the specified name in the specified directory. -
Route echo: You can echo any string using the URL
http://localhost:8080/echo/<string>. The server will respond with the same string. -
User agent: The server will respond with the user agent string on sending a request to
http://localhost:8080/user-agent. -
File Protection: The server will not allow access to files beginning with a '.' or a '_'