HandleFunc registers a function on the default mux. The function receives a response writer and a request. Write sends the body. ListenAndServe blocks until the server stops.
(defnhello[wr](let[path(.Path(.URLr))](.Writew(str"hello "path))nil))(net:http.HandleFunc"/hello/"hello)(println"listening on 127.0.0.1:18081")(let[err(net:http.ListenAndServe"127.0.0.1:18081"nil)](whenerr(println(.Errorerr))))
The process prints the address and then serves. Stop it with Ctrl-C.
$ glj http-server.glj
listening on 127.0.0.1:18081