Skip to content
Mongrel2 handlers in Julia
Julia
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example
src
LICENSE.md
README.md
REQUIRE

README.md

A Julia interface to Mongrel2

Mongrel2.jl is a package that enables writing Mongrel2 handlers in the Julia programming language.

Installation

Pkg.add("Mongrel2")

This will also install the dependent Julia packages: ZMQ and JSON

Install Mongrel2 and ZMQ libraries for your OS using your favourite package manager

Usage

Start Mongrel2 in the usual fashion with m2sh using a relevant configuration. Example

load("Mongrel2")
using Mongrel2

t = run_server("6DFF1523-C091-49B8-B635-598640E864B3", "tcp://127.0.0.1:9997", "tcp://127.0.0.1:9996")

 while true                                                                                            
    (conn, req) = consume (t) 
    response = "<html><body>Sender: $(req.sender_id)<br>ConnectionId: $(req.connection_id)<br>
                  Path: $(req.path)<br>Headers: $(string(req.headers))<br> Body: $(req.body)</html></body>"

    if is_disconnected(req); print("Disconnected $(req.connection_id) \n");continue; end
    reply_http(conn, req, response); disconnect_client(conn,req);
end

Navigate to http://localhost:6767/handlertest/

Something went wrong with that request. Please try again.