Simple Web Server

Simple Web Server to respond hello world.

Files

/package.nimble

# Package
version = "0.1.0"
author = "Jonathan Turnock"
description = "A Hello World Web Server"
license = "MIT"
srcDir = "src"
bin = @["server"]
binDir = "dist"
# Dependencies
requires "nim >= 1.4.0"

/src/server.nim

import asynchttpserver, asyncdispatch
var server = newAsyncHttpServer()
proc cb(req: Request) {.async.} =
await req.respond(Http200, "Hello World")
when isMainModule:
echo "WebServer Started visit http://localhost:8080/"
waitFor server.serve(Port(8080), cb)

References

๐Ÿ”— GitHub