Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Allen Lee
haskell-gargantext
Commits
dcb60231
Unverified
Commit
dcb60231
authored
Nov 26, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serve /index.html contents on route /
parent
04186169
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
package.yaml
package.yaml
+2
-0
API.hs
src/Gargantext/API.hs
+21
-6
No files found.
package.yaml
View file @
dcb60231
...
...
@@ -77,6 +77,7 @@ library:
-
attoparsec
-
base >=4.7 && <5
-
base16-bytestring
-
blaze-html
-
bytestring
-
case-insensitive
-
cassava
...
...
@@ -136,6 +137,7 @@ library:
-
semigroups
-
servant
-
servant-auth
-
servant-blaze
-
servant-client
-
servant-job
-
servant-mock
...
...
src/Gargantext/API.hs
View file @
dcb60231
...
...
@@ -56,11 +56,15 @@ import Network.Wai
import
Network.Wai.Handler.Warp
hiding
(
defaultSettings
)
import
Servant
import
Servant.HTML.Blaze
(
HTML
)
import
Servant.Mock
(
mock
)
--import Servant.Job.Server (WithCallbacks)
import
Servant.Static.TH.Internal.Server
(
fileTreeToServer
)
import
Servant.Static.TH.Internal.FileTree
(
fileTypeToFileTree
,
FileType
(
FileTypeFile
))
import
Servant.Swagger
import
Servant.Swagger.UI
-- import Servant.API.Stream
import
Text.Blaze.Html
(
Html
)
--import Gargantext.API.Swagger
import
Gargantext.Prelude
...
...
@@ -258,17 +262,24 @@ type GargAPI' =
-- :<|> "ngrams" :> Capture "id" Int :> NodeAPI
-- :<|> "auth" :> Capture "id" Int :> NodeAPI
---------------------------------------------------------------------
type
SwaggerFrontAPI
=
SwaggerAPI
:<|>
FrontEndAPI
type
SwaggerFrontAPI
=
SwaggerAPI
:<|>
FrontEndAPI
type
API
=
SwaggerFrontAPI
:<|>
GargAPI
:<|>
Get
'[
H
TML
]
Html
type
API
=
SwaggerFrontAPI
:<|>
GargAPI
---------------------------------------------------------------------
-- | Server declaration
-- | Server declarations
server
::
Env
->
IO
(
Server
API
)
server
env
=
do
gargAPI
<-
serverGargAPI
env
pure
$
swaggerFront
:<|>
gargAPI
:<|>
serverIndex
serverGargAPI
::
Env
->
IO
(
Server
GargAPI
)
serverGargAPI
env
=
do
-- orchestrator <- scrapyOrchestrator env
pure
$
swaggerFront
:<|>
auth
conn
pure
$
auth
conn
:<|>
roots
conn
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataAny
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataCorpus
)
...
...
@@ -282,6 +293,10 @@ server env = do
where
conn
=
env
^.
env_conn
serverIndex
::
Server
(
Get
'[
H
TML
]
Html
)
serverIndex
=
$
(
do
(
Just
s
)
<-
liftIO
(
fileTypeToFileTree
(
FileTypeFile
"purescript-gargantext/dist/index.html"
))
fileTreeToServer
s
)
---------------------------------------------------------------------
swaggerFront
::
Server
SwaggerFrontAPI
swaggerFront
=
schemaUiServer
swaggerDoc
...
...
@@ -295,7 +310,7 @@ makeApp :: Env -> IO Application
makeApp
=
fmap
(
serve
api
)
.
server
appMock
::
Application
appMock
=
serve
api
(
swaggerFront
:<|>
gargMock
)
appMock
=
serve
api
(
swaggerFront
:<|>
gargMock
:<|>
serverIndex
)
---------------------------------------------------------------------
api
::
Proxy
API
...
...
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