@hackage wai-cli0.2.3
Command line runner for Wai apps (using Warp) with TLS, CGI, socket activation & graceful shutdown
Categories
License
LicenseRef-PublicDomain
Maintainer
val@packett.cool
Links
Versions
Installation
Tested Compilers
Dependencies (16)
- ansi-terminal
- base >=4.8.0.0 && <10
- http-types
- iproute
- monads-tf
- network Show all…
Dependents (4)
@hackage/rfc, @hackage/microformats2-parser, @hackage/magicbane, @hackage/chakra
Package Flags
tls
(on by default)
Include warp-tls
fastcgi
(off by default)
Include wai-handler-fastcgi
unixsockets
(on by default)
Enable Unix sockets
wai-cli

A command line runner for Wai apps (using Warp) with support for:
--protocol http --port 8000TCP sockets--protocol unix --socket /var/run/app/sockUNIX domain sockets--protocol cgirunning as a CGI app (the original serverless lambda functions from the 90s)--protocol fastcgirunning as a FastCGI app (OPTIONAL! You need to build with thefastcgicabal flag and you need to havelibfcgi(e.g.fcgi-devkitpackage on FreeBSD) installed)--protocol activatesocket 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.pemTLS (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)--devloggingdevelopment logging (fromwai-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 and microformats2-parser's demo web app.
Now used in the magicbane framework (which was also extracted from sweetroll).
Usage
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.
License
This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.