Update to Io HttpServer

Filed under: io httpserver 

I upgraded to the bleeding edge from git of Io, and plenty of stuff has changed, notably the Volcano addon, which is the HTTP server I used in my previous post. It's changed enough that the old code won't work under the latest version, so here's an update.

server := HttpServer clone do (
    setPort ( 5000 )
    setHost ( "localhost" )

    renderResponse := method ( request, response,
        response body = (
            """<html><body>hello, world</body></html>"""
        )
    )
)

server start

It's left as an exercise for the reader to update the above to use something besides static HTML (such as Iota).

As a side-note, slice has been deprecated in the latest version of Io and Volcano needs a small fix (just change all occurrences of "slice" with "exclusiveSlice" in addons/Volcano/io/StatusCodes - there's two of them on the very last line).

[UPDATE: this is fixed in latest git ]



0 comments Leave a comment