Direct response example in http-server.rkt

This commit is contained in:
Tony Garnock-Jones 2024-04-10 15:40:32 +02:00
parent c7e8c55b58
commit bd973f069a
1 changed files with 11 additions and 0 deletions

View File

@ -52,4 +52,15 @@
`(h1 "Second page")
`(a ((href "/")) "Go back")))))
(spawn #:name 'server2
(at ds
(assert (HttpBinding #f 8080 'get (list (PathPatternElement-label "page3"))
(object
[(HttpContext req res)
(at res
(log-info "+page3")
(on-stop (log-info "-page3"))
(send! (HttpResponse-header 'content-type "text/plain"))
(send! (HttpResponse-done "this is page3\n")))])))))
)))