Here's the code: 
    
    
    import asynchttpserver, asyncdispatch
    
    var givenByUser = "test.nim"
    
    var server = newAsyncHttpServer()
    
    proc cb(req: Request) {.async.} =
      # import user.nim
      # use it's main proc
      await req.respond(Http200, procInFile())
    
    waitFor server.serve(Port(8080), cb)
    
    
    Run

The code that user might provide: 
    
    
    proc procInFile*():string =
      return "hello"
    
    
    Run

Reply via email to