nine_cowboy

View Source

A cowboy backend for the nine router compiler library.

nine_cowboy additionally provides common middleware and utility functions.

Build

rebar3 compile

Example

cd example
./setup.sh
rebar3 shell

Navigate to localhost:8080.

Usage

Configure the cowboy server with the routes generated by nine like this:

nine:compile(#{
    routes => ExampleRoutes,
    generator => nine_cowboy,
    router => example_router
}),
{ok, _} = cowboy:start_clear(example_http_listener,
    [{port, 8080}],
    #{middlewares => [example_router]}
).

Typically this goes in your application's start/2 function.

License

Apache V2