mirror of
https://github.com/codex-storage/nim-websock.git
synced 2025-02-09 01:04:19 +00:00
14 lines
462 B
Nim
14 lines
462 B
Nim
import ws, chronos, chronicles, httputils
|
|
|
|
proc cb(transp: StreamTransport, header: HttpRequestHeader) {.async.} =
|
|
info "Header: ", header
|
|
let res = await transp.sendHTTPResponse(HttpVersion11, Http200, "Hello World")
|
|
debug "Disconnecting client", address = transp.remoteAddress()
|
|
await transp.closeWait()
|
|
|
|
when isMainModule:
|
|
let address = "127.0.0.1:8888"
|
|
var httpServer = newHttpServer(address, cb)
|
|
httpServer.start()
|
|
waitFor httpServer.join()
|