http_lolo
A simple, lightweight, single-threaded HTTP server with non-blocking I/O for concurrent operation handling.
Features
- Single-threaded architecture with non-blocking I/O
- Concurrent request handling using epoll
- Simple and intuitive API for route handling
- Support for multiple server instances
- Customizable request and response handling
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
Usage
Creating a new server instance
let server = new;
adding a route handler
server.handle_route;
Starting the server
server.listen_on;
run_all;
Handling requests
Inside your route handler, you can access request data and write responses:
|req: &mut Request, resp: &mut ResponseWriter|
Advanced Usage
Multiple server instances
You can create multiple server instances listening on different ports:
let server1 = new;
let server2 = new;
// Add route handlers to server1 and server2
server1.listen_on;
server2.listen_on;
run_all;
JSON responses
use JsonValue;
resp.write_json;
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.