handler.nim
author Mahlon E. Smith <mahlon@martini.nu>
Wed, 27 Oct 2021 13:57:16 -0700
changeset 6 d49437ff8f2f
parent 4 ffb8b9920057
permissions -rw-r--r--
Updates for more recent (v1.6.0) nim.


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