packages feed

mig-server-0.1.0.0: mig-server.cabal

cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

name:               mig-server
version:            0.1.0.0
synopsis:           Build lightweight and composable servers
description:        With library mig we can build lightweight and composable servers.
                    There are only couple of combinators to assemble servers from parts.
                    It supports generic handler functions as servant does. But strives to use more
                    simple model for API. It does not go to describing Server API at type level which
                    leads to simpler error messages.
                    .
                    The main features are:
                    .
                    * lightweight library
                    .
                    * expressive DSL to compose servers
                    .
                    * type-safe handlers
                    .
                    * handlers are encoded with generic haskell functions
                    .
                    * built on top of WAI and warp server libraries.
                    .
                    Example of hello world server:
                    .
                    > import Mig.Json.IO
                    >
                    > -- | We can render the server and run it on port 8085.
                    > -- It uses wai and warp.
                    > main :: IO ()
                    > main = runServer 8085 server
                    >
                    > -- | Init simple hello world server whith two routes:
                    > server :: Server IO
                    > server =
                    >   "api/v1" /.
                    >       [ "hello" /. hello
                    >       , "bye" /. bye
                    >       ]
                    >
                    > -- | Handler takes no inputs and marked as Get HTTP-request that returns Text.
                    > hello :: Get (Resp Text)
                    > hello = pure $ ok "Hello World"
                    >
                    > -- | Handle with URL-param query and json body input as Post HTTP-request that returns Text.
                    > bye :: Query "name" Text -> Body Text -> Post (Resp Text)
                    > bye (Query name) (Body greeting) =
                    >   pure $ ok $ "Bye to " <> name <> " " <> greeting
                    .
                    Please see:
                    .
                    * quick start guide at <https://anton-k.github.io/mig/>
                    .
                    * examples directory for more fun servers: at <https://github.com/anton-k/mig/tree/main/examples/mig-example-apps#readme>
                    .
                    * reference for the main functions: <https://anton-k.github.io/mig/09-reference.html>
category:           Web
homepage:           https://github.com/anton-k/mig#readme
bug-reports:        https://github.com/anton-k/mig/issues
author:             Anton Kholomiov
maintainer:         anton.kholomiov@gmail.com
copyright:          2023 Anton Kholomiov
license:            BSD3
license-file:       LICENSE
build-type:         Simple
extra-source-files:
    README.md

source-repository head
  type: git
  location: https://github.com/anton-k/mig

library
  exposed-modules:
      Mig
      Mig.Html
      Mig.Html.IO
      Mig.IO
      Mig.Json
      Mig.Json.IO
      Mig.Server.Warp
  other-modules:
      Paths_mig_server
  hs-source-dirs:
      src
  default-extensions:
      DerivingStrategies
      DuplicateRecordFields
      LambdaCase
      OverloadedRecordDot
      OverloadedStrings
      StrictData
      TypeFamilies
  ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -Wunused-packages
  build-depends:
      aeson
    , base >=4.7 && <5
    , blaze-html
    , data-default
    , http-api-data
    , http-types
    , mig >=0.2
    , mig-extra >=0.1
    , mig-swagger-ui >=0.1
    , mig-wai >=0.1
    , openapi3
    , text
    , transformers
    , warp
  default-language: GHC2021