Command line runner for Wai apps (using Warp) with TLS, CGI, socket activation & graceful shutdown
Go to file
Val Packett 8ae0252694 update readme link 2022-10-16 15:29:55 +03:00
library/Network/Wai Use unicodes and simplify getActivatedSockets 2021-01-15 23:14:29 +03:00
.gitignore initial commit 2017-01-24 00:27:42 +03:00 initial commit 2017-01-24 00:27:42 +03:00 update readme link 2022-10-16 15:29:55 +03:00
Setup.hs initial commit 2017-01-24 00:27:42 +03:00
UNLICENSE initial commit 2017-01-24 00:27:42 +03:00
stack.yaml update stack resolver 2022-07-31 23:42:25 +03:00
stack.yaml.lock update stack resolver 2022-07-31 23:42:25 +03:00
wai-cli.cabal Update project stuff 2022-10-16 15:27:58 +03:00

wai-cli Hackage unlicense

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 fastcgi running as a FastCGI app (OPTIONAL! You need to build with the fastcgi cabal flag and you need to have libfcgi (e.g. fcgi-devkit package on FreeBSD) installed)
  • --protocol activate socket activation (systemd-compatible, but not restricted to systemd in any way. see 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)
  • --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)


Add a dependency on wai-cli and write something like this:

{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Network.Wai.Cli
import Data.Monoid (mconcat)

app = scottyApp $ do
  get "/:word" $ do
    beam <- param "word"
    html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"]

main = defWaiMain =<< app

Want to use command line args for your application-specific settings? Don't. Use environment variables instead. Possibly with dotenv to load some of them from a file. envy is a really awesome way to read them.


This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or