A simple HTTP server example using the fasthttp module from vlib/fasthttp.
./v examples/fasthttp
./examples/fasthttp/fasthttp
The server will listen on http://localhost:3000
curl http://localhost:3000/
curl http://localhost:3000/user/123
curl -X POST http://localhost:3000/user
curl http://localhost:3000/notfound
main.v - Entry point and request routercontrollers.v - Request handlers for different routesv.mod - Module metadataThe example demonstrates:
handle_request() function routes incoming HTTP requests based on
method and path[]u8 (byte arrays)The fasthttp module handles: