Browse Source

update: mofuw (#3935)

* fix type

* fix fuck import
momf 7 years ago
parent
commit
bf0af2d207
1 changed files with 6 additions and 3 deletions
  1. 6 3
      frameworks/Nim/mofuw/techempower.nim

+ 6 - 3
frameworks/Nim/mofuw/techempower.nim

@@ -1,7 +1,7 @@
 import mofuw, packedjson
 import mofuw, packedjson
 
 
-proc h(req: mofuwReq, res: mofuwRes) {.async.} =
-  case req.getPath
+proc h(ctx: MofuwCtx) {.async.} =
+  case ctx.getPath
   of "/plaintext":
   of "/plaintext":
     mofuwResp(HTTP200, "text/plain", "Hello, World!")
     mofuwResp(HTTP200, "text/plain", "Hello, World!")
   of "/json":
   of "/json":
@@ -9,4 +9,7 @@ proc h(req: mofuwReq, res: mofuwRes) {.async.} =
   else:
   else:
     mofuwResp(HTTP404, "text/plain", "NOT FOUND")
     mofuwResp(HTTP404, "text/plain", "NOT FOUND")
 
 
-h.mofuwRun(port = 8080)
+newServeCtx(
+  port = 8080,
+  handler = h
+).serve()