This project is deprecated. Please use HTTP.jl
This is a basic, non-blocking HTTP server in Julia.
You can write a basic application using just this if you're happy dealing with values representing HTTP requests and responses directly. For a higher-level view, you could use Mux. If you'd like to use WebSockets as well, you'll need to grab WebSockets.jl.
Use Julia package manager to install this package as follows:
Pkg.add("HttpServer")
- binds to any address and port
- supports IPv4 & IPv6 addresses
- supports HTTP, HTTPS and Unix socket transports
You can find many examples of how to use this package in the examples
folder.
using HttpServer
http = HttpHandler() do req::Request, res::Response
Response( ismatch(r"^/hello/",req.resource) ? string("Hello ", split(req.resource,'/')[3], "!") : 404 )
end
server = Server( http )
run( server, 8000 )
# or
run(server, host=IPv4(127,0,0,1), port=8000)
If you open up localhost:8000/hello/name/
in your browser, you should get a greeting from the server.
:::::::::::::
:: ::
:: Made at ::
:: ::
:::::::::::::
::
Hacker School
:::::::::::::