def main [
local-scope
socket:num <- $open-server-socket 8080/port
$print [Mu socket creation returned ], socket, 10/newline
return-unless socket
session:num <- $accept socket
contents:&:source:char, sink:&:sink:char <- new-channel 30
sink <- start-running receive-from-socket session, sink
query:text <- drain contents
$print [Done reading from socket.], 10/newline
write-to-socket session, [HTTP/1.0 200 OK
Content-type: text/plain
SUCCESS!
]
$print 10/newline, [Wrote to and closing socket...], 10/newline
$close-socket session
$close-socket socket
]