Popularity
3.6
Declining
Activity
0.0
Stable
4
2
1

Monthly Downloads: 9
Programming language: Haskell
License: MIT License
Tags: Web    

haskyapi alternatives and similar packages

Based on the "Web" category.
Alternatively, view haskyapi alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of haskyapi or a related project?

Add another 'Web' Package

README

Build Status

What is Haskyapi?

Haskyapi is a HTTP server implemented in Haskell.

Build

$ stack build
$ stack install
$ haskyapi runserver --port 8080 --root .
root: .
listen on 8080
http://localhost:8080/
http://localhost:8080/index.html
http://localhost:8080/hoge.md

or

$ cabal build

Options

  • -p, --port : port number
  • -r, --root : root directory
  • -h, --help : help

setting.yml is a configuration file for these options.

How to use as web framework

app/Main.hs in this repository is an example program using haskyapi as web framework.

Here is a very simple example.

module Main where
import Web.Haskyapi.Console.Cli (haskyapi)
import Web.Haskyapi.Header (
  Api,
  ApiFunc,        -- type of api functions, Query -> Body -> IO String
  Method(..),     -- GET, POST, ...
  ContentType(..) -- Cplain, Cjson, ...
  )

routing :: [Api]
routing = [
             (GET,  "/test", test , Cplain)
            ,(POST, "/test", test2, Cplain)
          ]

test :: ApiFunc
test qry bdy = return "This is GET."

test2 :: ApiFunc
test2 qry bdy = return "This is POST."

main = haskyapi routing
$ runhaskell Main.hs runserver
$ curl -XGET http://localhost:8080/api/test
This is GET.
$ curl -XPOST http://localhost:8080/api/test
This is POST.

TODO

  • [ ] HTTPS

Bash-completion

.haskyapi.bash is a bash-completion setting file for haskyapi command.