* refactor project, add test, add readBody proc * use non-fork version of picohttpparser * use nimdoc link for asynchttpserver * catch IOSelectorsException when accepting sockets --------- Co-authored-by: Philip Wernersbach <philip.wernersbach@gmail.com> |
||
|---|---|---|
| src | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| microasynchttpserver.nimble | ||
| README.md | ||
microasynchttpserver
microasynchttpserver is a thin asynchronous HTTP server library for Nim. It is API-compatible with Nim's built-in asynchttpserver, and allows programs greater control over the HTTP connection than asynchttpserver does.
Features
- Production-ready
- Uses nim-picohttpparser for HTTP header parsing
- Acts as a thin HTTP server library
- Only parses HTTP method, protocol version, URL, and headers
- Everything else is up to the application
Usage
microasynchttpserver is mostly API compatible with
asynchttpserver.
Use the newMicroAsyncHttpServer proc to instantiate a MicroAsyncHttpServer,
and use it just like an AsyncHttpServer.
MicroAsyncHttpServer will only fill in the client, reqMethod, headers,
protocol, url, and hostname fields of Request objects. HTTP request
bodies/data must be handled by your application, and read directly from the
client socket.
As a convenience, you can use the readBody proc provided by this library to read the entire request body to memory.
Note that this will not set the Request object's body field; it will only return the body that was read.
License
This project is licensed under the MIT License. For full license text, see
LICENSE.