simplify the example a bit
This commit is contained in:
parent
dfc2676c25
commit
1a105448f0
1 changed files with 4 additions and 2 deletions
|
@ -47,6 +47,8 @@ instance (KnownSymbol capture, Captured a, HasServer sublayout)
|
||||||
}
|
}
|
||||||
_ -> return Nothing
|
_ -> return Nothing
|
||||||
|
|
||||||
|
-- * Example
|
||||||
|
|
||||||
type TestApi = "hello" :> Capture "name" Text :> Get Greet
|
type TestApi = "hello" :> Capture "name" Text :> Get Greet
|
||||||
|
|
||||||
testApi :: Proxy TestApi
|
testApi :: Proxy TestApi
|
||||||
|
@ -59,8 +61,8 @@ instance ToJSON Greet
|
||||||
|
|
||||||
server :: Server TestApi
|
server :: Server TestApi
|
||||||
server =
|
server =
|
||||||
(Proxy :: Proxy "hello")
|
Proxy -- :: Proxy "hello"
|
||||||
:> (Proxy :: Proxy (Capture "name" Text))
|
:> Proxy -- :: Proxy (Capture "name" Text)
|
||||||
:> (return . func)
|
:> (return . func)
|
||||||
|
|
||||||
where func name = Greet ("Hello, " <> name)
|
where func name = Greet ("Hello, " <> name)
|
||||||
|
|
Loading…
Reference in a new issue