A friendly embedded web server for the Raspberry Pi Pico W, based on the lwip TCP/IP stack. Pairs with picostdlib.
Set up a pico W project with piconim, then:
import picostdlib/[gpio, time, cyw43]
import lwhttp
proc requested(r: Request, httpMethod: HttpMethod, path: string) =
case $httpMethod & " " & path
of "GET /":
r.respond(Http200, "hello from the pico")
else:
r.respond(Http404, $Http404)
startHttp(requested, 80)respond takes an optional headers argument if you need cookies or
content types:
r.respond(Http200, body, newHttpHeaders([("Content-Type", "text/plain")]))MIT