mirror of
https://github.com/logos-storage/nim-websock.git
synced 2026-01-10 01:23:06 +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()
|