# wai-cli [![Hackage](https://img.shields.io/hackage/v/wai-cli.svg?style=flat)](https://hackage.haskell.org/package/wai-cli) [![Build Status](https://img.shields.io/travis/myfreeweb/wai-cli.svg?style=flat)](https://travis-ci.org/myfreeweb/wai-cli) [![unlicense](https://img.shields.io/badge/un-license-green.svg?style=flat)](http://unlicense.org) A command line runner for Wai apps (using Warp) with support for: - `--protocol http --port 8000` TCP sockets - `--protocol unix --socket /var/run/app/sock` UNIX domain sockets - `--protocol cgi` running as a CGI app (the original serverless lambda functions from the 90s) - `--protocol activate` socket activation (systemd-compatible, but not restricted to systemd in any way. see [soad](https://github.com/myfreeweb/soad) for an interesting use of (de)activation!) - `--protocol (http+tls|unix+tls|activate+tls) --tlskey key.pem --tlscert cert.pem` TLS (can be turned off with a cabal flag to avoid compiling [the TLS library](https://github.com/vincenthz/hs-tls)) - `--graceful (none|serve-normally|serve-503)` graceful shutdown (on TERM signal) - `--devlogging` development logging (from `wai-extra`) - printing a pretty and colorful run message (e.g. `Running on http port 3000 with 4 CPUs`) (you can replace it with your own, or with nothing) Extracted from [sweetroll](https://github.com/myfreeweb/sweetroll) / [wai-cli](https://github.com/myfreeweb/wai-cli)'s demo web app. ## Usage Add a dependency on `wai-cli` and write something like this: ```haskell {-# LANGUAGE OverloadedStrings #-} import Web.Scotty import Network.Wai.Cli import Data.Monoid (mconcat) app = scottyApp $ do get "/:word" $ do beam <- param "word" html $ mconcat ["

Scotty, ", beam, " me up!

"] main = defWaiMain =<< app ``` Want to use command line args for your application-specific settings? Don't. Use environment variables instead. (Possibly with [dotenv](https://github.com/stackbuilders/dotenv-hs) to load some of them from a file.) ## License This is free and unencumbered software released into the public domain. For more information, please refer to the `UNLICENSE` file or [unlicense.org](http://unlicense.org).