Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

JuliaWeb/HttpServer.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is deprecated. Please use HTTP.jl

HttpServer.jl

Build Status codecov.io

HttpServer HttpServer HttpServer HttpServer

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.

Installation

Use Julia package manager to install this package as follows:

Pkg.add("HttpServer")

Functionality

  • 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.

Example

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
:::::::::::::