Hello I am new to nim. I have the following code and i don't understand what is 
wrong.

* * *
    
    
    import json, asynchttpserver, asyncdispatch
    
    var server = newAsyncHttpServer()
    
    var j = %* {
        "test": 1,
        "test2": "42",
    }
    
    proc cb(req: Request) {.async.} =
        await req.respond(Http200, json.pretty(j))
    
    waitFor server.serve(Port(8080), cb)
    

**Error**:

main.nim(13, 15) Error: type mismatch: got (AsyncHttpServer, Port, proc (req: 
Request): Future[system.void]{.locks: <unknown>.}) but expected one of:

proc serve(server: AsyncHttpServer; port: Port;
    callback: proc (request: Request): Future[void]; address = ""): Future[void]

Reply via email to