Starting a simple web server using HTTP.jl

Check the information about HTTP.Handers or the web doc of the package, that it has a lot of examples.

I put you an simple example that is working in my computer:

const ROUTER = HTTP.Router()
HTTP.@register(ROUTER, "GET", "/*", req->HTTP.Response(200, "Hi"))
# You can register more
HTTP.@register(ROUTER, "GET", "/bye", req->HTTP.Response(200, "Bye!"))
HTTP.serve(ROUTER, Sockets.localhost, 8081)

I hope it could help you.

4 Likes