AZ
Size: a a a
AZ
p
𝛈µ
AZ
p
AZ
𝛈µ
𝛈µ
p
p
AZ
type UserAPI = "users" :> Get '[JSON] [User]
:<|> "albert" :> Get '[JSON] User
:<|> "isaac" :> Get '[JSON] User𝛈µ
𝛈µ
AZ
isaac :: User
isaac = User "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1)
albert :: User
albert = User "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1)
users :: Handler [User]
users = liftIO getPersonsAZ
server :: Server API
server = swaggerSchemaUIServer swaggerDoc :<|> users :<|> pure albert :<|> pure isaacp
AZ
type API = SwaggerSchemaUI "swagger-ui" "swagger.json"
:<|> UserAPI
swaggerDoc :: Swagger
swaggerDoc = toSwagger (Proxy :: Proxy UserAPI)
& info.title .~ "Operden API"
& info.version .~ "1.0.0"
& info.description ?~ "This is an API that perform some operen actions"λ
AZ
someFunc :: IO ()
someFunc = do
print $ foo "Running"
--_ <- m
print $ foo "Inserted"
hFlush stdout
run 8081 app𝛈µ
type UserAPI = "users" :> Get '[JSON] [User]
:<|> "albert" :> Get '[JSON] User
:<|> "isaac" :> Get '[JSON] User