haskyapi 0.0.0.1 → 0.0.0.2
raw patch · 2 files changed
+34/−5 lines, 2 files
Files
- README.md +30/−1
- haskyapi.cabal +4/−4
README.md view
@@ -12,7 +12,7 @@ $ stack build $ stack install $ haskyapi migrate-$ haskyapi runserver -p 8080 -r .+$ haskyapi runserver --port 8080 --root . root: . listen on 8080 http://localhost:8080/@@ -35,6 +35,35 @@ `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.++```hs+module Main where+import Web.Haskyapi.Console.Cli (haskyapi)+import Web.Haskyapi.Header (+ Api,+ ApiFunc, -- type of api functions+ Method(..), -- GET, POST, ...+ ContentType(..) -- Cplain, Cjson, ...+ )++routing :: [Api]+routing = [+ (GET, "/test", test, Cplain)+ ,(POST, "/test", test, Cplain)+ ]++test :: ApiFunc+test qry _ = return "This is GET."+test qry _ = return "This is POST."++main = haskyapi routing+``` ## TODO
haskyapi.cabal view
@@ -2,17 +2,17 @@ -- -- see: https://github.com/sol/hpack ----- hash: 23fca1f928d50c27458e9b0ae3906f6fdf1eedfe8923e316b5deb55cbb72b3ca+-- hash: 3b909307148be9caa35a1053e4ccbd451d0286afc07e8c70511815d2f50dffdc name: haskyapi-version: 0.0.0.1+version: 0.0.0.2 synopsis: HTTP server-description: Please see the README on Github at <https://github.com/okue/haskyapi#readme>+description: Haskell HTTP server. category: Web homepage: https://github.com/okue/haskyapi#readme bug-reports: https://github.com/okue/haskyapi/issues author: okue-maintainer: example@example.com+maintainer: nogideca@gmail.com copyright: 2017 okue license: MIT license-file: LICENSE