Direct response example in http-server.rkt
This commit is contained in:
parent
c7e8c55b58
commit
bd973f069a
|
@ -52,4 +52,15 @@
|
||||||
`(h1 "Second page")
|
`(h1 "Second page")
|
||||||
`(a ((href "/")) "Go back")))))
|
`(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")))])))))
|
||||||
|
|
||||||
)))
|
)))
|
||||||
|
|
Loading…
Reference in New Issue