Created
October 28, 2017 16:15
-
-
Save enthus1ast/f878e3ec23cb9d267ca2b3439ea2bc90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncdispatch, asynchttpserver | |
type SomeObj = object | |
someData: string | |
proc manageUiCallback(req: Request): Future[void] {.async.} = | |
var res = "" | |
# This callback wants to access someObj somehow! | |
res.add someObj.someData | |
await req.respond(Http200, res) | |
var someObj = SomeObj(someData: "foo") | |
var server = newAsyncHttpServer() | |
waitFor server.serve(Port(8080), manageUiCallback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment