Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
6d58acdd
Commit
6d58acdd
authored
Feb 03, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API][CLEAN] cosmetics.
parent
ad22b372
Pipeline
#725
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
API.hs
src/Gargantext/API.hs
+8
-12
No files found.
src/Gargantext/API.hs
View file @
6d58acdd
...
@@ -21,7 +21,8 @@ The Garg-API-Monad enables:
...
@@ -21,7 +21,8 @@ The Garg-API-Monad enables:
- In Memory stack management (short term)
- In Memory stack management (short term)
- Logs (WIP)
- Logs (WIP)
Thanks to @yannEsposito (at the start) and @np (after).
Thanks to Yann Esposito for our discussions at the start and to Nicolas
Pouillard (who mainly made it).
-}
-}
...
@@ -315,9 +316,11 @@ type GargPrivateAPI' =
...
@@ -315,9 +316,11 @@ type GargPrivateAPI' =
-- :<|> "ngrams" :> Capture "node_id" Int :> NodeAPI
-- :<|> "ngrams" :> Capture "node_id" Int :> NodeAPI
-- :<|> "auth" :> Capture "node_id" Int :> NodeAPI
-- :<|> "auth" :> Capture "node_id" Int :> NodeAPI
---------------------------------------------------------------------
---------------------------------------------------------------------
type
SwaggerFrontAPI
=
SwaggerAPI
:<|>
FrontEndAPI
type
API
=
SwaggerFrontAPI
:<|>
GargAPI
:<|>
Get
'[
H
TML
]
Html
type
API
=
SwaggerAPI
:<|>
FrontEndAPI
:<|>
GargAPI
:<|>
Get
'[
H
TML
]
Html
-- This is the concrete monad. It needs to be used as little as possible,
-- This is the concrete monad. It needs to be used as little as possible,
-- instead, prefer GargServer, GargServerT, GargServerC.
-- instead, prefer GargServer, GargServerT, GargServerC.
...
@@ -336,7 +339,8 @@ type EnvC env =
...
@@ -336,7 +339,8 @@ type EnvC env =
server
::
forall
env
.
EnvC
env
=>
env
->
IO
(
Server
API
)
server
::
forall
env
.
EnvC
env
=>
env
->
IO
(
Server
API
)
server
env
=
do
server
env
=
do
-- orchestrator <- scrapyOrchestrator env
-- orchestrator <- scrapyOrchestrator env
pure
$
swaggerFront
pure
$
schemaUiServer
swaggerDoc
:<|>
frontEndServer
:<|>
hoistServerWithContext
(
Proxy
::
Proxy
GargAPI
)
(
Proxy
::
Proxy
AuthContext
)
transform
serverGargAPI
:<|>
hoistServerWithContext
(
Proxy
::
Proxy
GargAPI
)
(
Proxy
::
Proxy
AuthContext
)
transform
serverGargAPI
:<|>
serverStatic
:<|>
serverStatic
where
where
...
@@ -420,13 +424,8 @@ serverStatic = $(do
...
@@ -420,13 +424,8 @@ serverStatic = $(do
)
)
---------------------------------------------------------------------
---------------------------------------------------------------------
swaggerFront
::
Server
SwaggerFrontAPI
swaggerFront
=
schemaUiServer
swaggerDoc
:<|>
frontEndServer
--gargMock :: Server GargAPI
--gargMock :: Server GargAPI
--gargMock = mock apiGarg Proxy
--gargMock = mock apiGarg Proxy
---------------------------------------------------------------------
---------------------------------------------------------------------
makeApp
::
EnvC
env
=>
env
->
IO
Application
makeApp
::
EnvC
env
=>
env
->
IO
Application
makeApp
env
=
serveWithContext
api
cfg
<$>
server
env
makeApp
env
=
serveWithContext
api
cfg
<$>
server
env
...
@@ -439,7 +438,6 @@ makeApp env = serveWithContext api cfg <$> server env
...
@@ -439,7 +438,6 @@ makeApp env = serveWithContext api cfg <$> server env
--appMock :: Application
--appMock :: Application
--appMock = serve api (swaggerFront :<|> gargMock :<|> serverStatic)
--appMock = serve api (swaggerFront :<|> gargMock :<|> serverStatic)
---------------------------------------------------------------------
---------------------------------------------------------------------
api
::
Proxy
API
api
::
Proxy
API
api
=
Proxy
api
=
Proxy
...
@@ -447,12 +445,10 @@ api = Proxy
...
@@ -447,12 +445,10 @@ api = Proxy
apiGarg
::
Proxy
GargAPI
apiGarg
::
Proxy
GargAPI
apiGarg
=
Proxy
apiGarg
=
Proxy
---------------------------------------------------------------------
---------------------------------------------------------------------
schemaUiServer
::
(
Server
api
~
Handler
Swagger
)
schemaUiServer
::
(
Server
api
~
Handler
Swagger
)
=>
Swagger
->
Server
(
SwaggerSchemaUI'
dir
api
)
=>
Swagger
->
Server
(
SwaggerSchemaUI'
dir
api
)
schemaUiServer
=
swaggerSchemaUIServer
schemaUiServer
=
swaggerSchemaUIServer
-- Type Family for the Documentation
-- Type Family for the Documentation
type
family
TypeName
(
x
::
*
)
::
Symbol
where
type
family
TypeName
(
x
::
*
)
::
Symbol
where
TypeName
Int
=
"Int"
TypeName
Int
=
"Int"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment