https://github.com/ringabout/httpx
Cross platform web server for Nim.
https://github.com/ringabout/httpx
Last synced: 3 months ago
JSON representation
Cross platform web server for Nim.
- Host: GitHub
- URL: https://github.com/ringabout/httpx
- Owner: ringabout
- License: apache-2.0
- Created: 2020-08-04T08:18:06.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T08:57:20.000Z (over 1 year ago)
- Last Synced: 2025-10-23T13:41:08.231Z (7 months ago)
- Language: Nim
- Homepage:
- Size: 82 KB
- Stars: 93
- Watchers: 5
- Forks: 6
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nim - httpx - Cross platform web server for Nim. A fork of httpbeast adding Windows support. (Web / HTTP Servers)
README
# httpx
This project is based on Dom96's perfect work on [httpbeast](https://github.com/dom96/httpbeast) and adds windows support(based on `wepoll` namely IOCP).
It is also used by [prologue](https://github.com/planety/prologue).
## Installation
```
nimble install httpx
```
## Notes
Notes that multi-threads may be slower than single-thread!
## Usage
### Change server info name
```
-d:serverInfo:serverName
```
### Enable threads
```
--threads:on
```
## Hello world
```nim
import options, asyncdispatch
import httpx
proc onRequest(req: Request): Future[void] =
if req.httpMethod == some(HttpGet):
case req.path.get()
of "/":
req.send("Hello World")
else:
req.send(Http404)
run(onRequest)
```
## Websocket support
https://github.com/ringabout/websocketx
```
nimble install https://github.com/ringabout/websocketx
```