2020-04-20 14:02:21 +03:00
|
|
|
|
{-# START_FILE {{name}}.cabal #-}
|
|
|
|
|
name: {{name}}
|
|
|
|
|
version: 0.1.0.0
|
|
|
|
|
|
|
|
|
|
-- synopsis:
|
|
|
|
|
-- description:
|
|
|
|
|
homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme
|
|
|
|
|
author: {{author-name}}{{^author-name}}Author name here{{/author-name}}
|
|
|
|
|
maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}}
|
|
|
|
|
copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2020{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}
|
|
|
|
|
category: {{category}}{{^category}}Web{{/category}}
|
|
|
|
|
build-type: Simple
|
|
|
|
|
cabal-version: >=1.10
|
|
|
|
|
extra-source-files: README.md
|
|
|
|
|
|
|
|
|
|
executable {{name}}
|
|
|
|
|
hs-source-dirs: src
|
|
|
|
|
main-is: Main.hs
|
2020-11-02 11:42:35 +03:00
|
|
|
|
ghc-options: -Wall
|
2020-04-20 14:02:21 +03:00
|
|
|
|
default-language: Haskell2010
|
|
|
|
|
build-depends:
|
|
|
|
|
base >=4.12 && <5
|
|
|
|
|
, conduit
|
2020-11-19 11:04:24 +03:00
|
|
|
|
, mu-graphql >=0.4.1
|
2020-10-12 15:56:18 +03:00
|
|
|
|
, mu-rpc >=0.4.0
|
|
|
|
|
, mu-schema >=0.3.1
|
2020-04-20 14:02:21 +03:00
|
|
|
|
, text
|
|
|
|
|
, wai-extra
|
|
|
|
|
, warp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-# START_FILE stack.yaml #-}
|
2020-11-19 11:04:24 +03:00
|
|
|
|
resolver: lts-16.22
|
2020-04-20 14:02:21 +03:00
|
|
|
|
allow-newer: true
|
|
|
|
|
extra-deps:
|
2020-11-02 11:42:35 +03:00
|
|
|
|
- mu-schema-0.3.1.1
|
2020-11-19 11:04:24 +03:00
|
|
|
|
- mu-rpc-0.4.0.1
|
|
|
|
|
- mu-graphql-0.4.1.0
|
|
|
|
|
- graphql-0.11.0.0
|
2020-11-02 11:42:35 +03:00
|
|
|
|
- primitive-extras-0.8
|
|
|
|
|
- primitive-unlifted-0.1.3.0
|
|
|
|
|
- stm-hamt-1.2.0.4
|
|
|
|
|
- stm-containers-1.1.0.4
|
|
|
|
|
- stm-lifted-2.5.0.0
|
2020-04-20 14:02:21 +03:00
|
|
|
|
|
|
|
|
|
{-# START_FILE Setup.hs #-}
|
|
|
|
|
import Distribution.Simple
|
|
|
|
|
main = defaultMain
|
|
|
|
|
|
|
|
|
|
{-# START_FILE .gitignore #-}
|
|
|
|
|
.stack-work/
|
|
|
|
|
stack*.yaml.lock
|
|
|
|
|
*~
|
|
|
|
|
|
|
|
|
|
{-# START_FILE README.md #-}
|
|
|
|
|
# {{name}}
|
|
|
|
|
|
|
|
|
|
{-# START_FILE schema.graphql #-}
|
|
|
|
|
type Query {
|
|
|
|
|
hello: String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{-# START_FILE src/Main.hs #-}
|
|
|
|
|
{-# language DataKinds #-}
|
|
|
|
|
{-# language FlexibleContexts #-}
|
|
|
|
|
{-# language OverloadedStrings #-}
|
|
|
|
|
{-# language PartialTypeSignatures #-}
|
|
|
|
|
{-# language PolyKinds #-}
|
|
|
|
|
{-# language ScopedTypeVariables #-}
|
|
|
|
|
{-# language TemplateHaskell #-}
|
|
|
|
|
{-# language TypeApplications #-}
|
2020-11-02 11:42:35 +03:00
|
|
|
|
{-# language TypeFamilies #-}
|
2020-04-20 14:02:21 +03:00
|
|
|
|
{-# language TypeOperators #-}
|
2020-11-02 11:42:35 +03:00
|
|
|
|
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
|
2020-04-20 14:02:21 +03:00
|
|
|
|
|
|
|
|
|
module Main where
|
|
|
|
|
|
|
|
|
|
import Data.Proxy
|
|
|
|
|
|
|
|
|
|
import Mu.GraphQL.Quasi
|
|
|
|
|
import Mu.GraphQL.Server
|
|
|
|
|
import Mu.Server
|
|
|
|
|
|
2020-04-22 15:27:27 +03:00
|
|
|
|
graphql "ServiceDefinition" "schema.graphql"
|
2020-04-20 14:02:21 +03:00
|
|
|
|
|
|
|
|
|
-- GraphQL App
|
|
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
|
main = do
|
|
|
|
|
putStrLn "starting GraphQL server on port 8080"
|
|
|
|
|
runGraphQLAppQuery 8080 server (Proxy @"Query")
|
|
|
|
|
|
|
|
|
|
type ServiceMapping = '[]
|
|
|
|
|
|
2020-11-02 11:42:35 +03:00
|
|
|
|
server :: MonadServer m => ServerT ServiceMapping i ServiceDefinition m _
|
2020-04-20 14:02:21 +03:00
|
|
|
|
server = resolver ( object @"Query" ( method @"hello" $ error "not implemented" ) )
|