tlwip.nim 753 B

12345678910111213141516171819202122232425262728293031
  1. discard """
  2. targets: "c"
  3. cmd: "nim $target --compileOnly --os:freertos --gc:arc $options $file"
  4. disabled: "bsd"
  5. disabled: "windows"
  6. action: compile
  7. """
  8. # Note:
  9. # This file tests FreeRTOS/LwIP cross-compilation on UNIX platforms
  10. # Windows should run when compiled with esp-idf, however I'm not
  11. # sure how to test for only compilation on Windows without running
  12. # a test exe
  13. #
  14. # Note:
  15. # disabling *BSDs since they're not playing well with `gcc`
  16. import net
  17. import asynchttpserver, asyncdispatch
  18. proc cb*(req: Request) {.async.} =
  19. await req.respond(Http200, "Hello World")
  20. proc run_http_server*() {.exportc.} =
  21. echo "starting http server"
  22. var server = newAsyncHttpServer()
  23. waitFor server.serve(Port(8181), cb)
  24. echo("ok")