handler.nim
author Mahlon E. Smith <mahlon@martini.nu>
Mon, 08 Oct 2018 12:31:27 -0700
changeset 4 ffb8b9920057
parent 0 f480e159f575
permissions -rw-r--r--
Re-arrange for use with nimble, updates for nim 0.19.


import src/mongrel2

let handler = newM2Handler( "mlist", "tcp://127.0.0.1:9019", "tcp://127.0.0.1:9018" )

proc woo( request: M2Request ): M2Response =
    var response = request.response

    response[ "Content-Type" ] = "text/plain"
    response.body   = "Hi there."
    response.status = HTTP_OK
    return response

# handler.action = woo
handler.run