No description
Find a file
Ian 2f20651432
Refactor for new Nimble structure, add readBody proc, add more docs (#1)
* 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>
2023-04-16 07:42:55 -07:00
src Refactor for new Nimble structure, add readBody proc, add more docs (#1) 2023-04-16 07:42:55 -07:00
tests Refactor for new Nimble structure, add readBody proc, add more docs (#1) 2023-04-16 07:42:55 -07:00
.gitignore Initial commit 2016-08-20 21:56:24 -04:00
LICENSE Initial commit 2016-08-20 21:56:24 -04:00
microasynchttpserver.nimble Refactor for new Nimble structure, add readBody proc, add more docs (#1) 2023-04-16 07:42:55 -07:00
README.md Refactor for new Nimble structure, add readBody proc, add more docs (#1) 2023-04-16 07:42:55 -07:00

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.