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
Przemyslaw Kaminski
haskell-gargantext
Commits
e2b806d9
Commit
e2b806d9
authored
Feb 07, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TEXT] String to Text in Servant file.
parent
4146f536
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
Prelude.hs
src/Gargantext/Prelude.hs
+1
-1
Server.hs
src/Gargantext/Server.hs
+15
-12
No files found.
src/Gargantext/Prelude.hs
View file @
e2b806d9
...
...
@@ -24,7 +24,7 @@ import Protolude ( Bool(True, False), Int, Double, Integer
,
sum
,
fromIntegral
,
length
,
fmap
,
takeWhile
,
sqrt
,
undefined
,
identity
,
abs
,
maximum
,
minimum
,
return
,
snd
,
truncate
,
(
+
),
(
*
),
(
/
),
(
-
),
(
.
),
(
>=
),
(
$
),
(
**
),
(
^
),
(
<
),
(
>
),
(
==
)
,
(
+
),
(
*
),
(
/
),
(
-
),
(
.
),
(
>=
),
(
$
),
(
**
),
(
^
),
(
<
),
(
>
),
(
==
)
,
(
<>
)
)
-- TODO import functions optimized in Utils.Count
...
...
src/Gargantext/Server.hs
View file @
e2b806d9
...
...
@@ -8,6 +8,8 @@ Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Main REST API of Gargantext (both Server and Client sides)
-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
...
...
@@ -20,7 +22,8 @@ module Gargantext.Server
-- )
where
import
Prelude
hiding
(
null
)
import
Gargantext.Prelude
import
Control.Monad
import
Control.Monad.IO.Class
import
Data.Aeson
...
...
@@ -30,8 +33,8 @@ import Servant
import
Servant.Multipart
import
Database.PostgreSQL.Simple
(
Connection
,
connect
)
import
Opaleye
import
System.IO
(
FilePath
)
import
System.IO
(
FilePath
,
putStrLn
,
readFile
,
print
)
import
Data.Text
(
Text
(),
pack
)
import
Gargantext.Types.Main
(
Node
,
NodeId
)
import
Gargantext.Database.Node
(
getNodesWithParentId
,
getNode
)
import
Gargantext.Database.Private
(
databaseParameters
)
...
...
@@ -43,8 +46,8 @@ type NodeAPI = Get '[JSON] (Node Value)
type
API
=
"roots"
:>
Get
'[
J
SON
]
[
Node
Value
]
:<|>
"node"
:>
Capture
"id"
Int
:>
NodeAPI
:<|>
"echo"
:>
Capture
"string"
String
:>
Get
'[
J
SON
]
String
:<|>
"upload"
:>
MultipartForm
MultipartData
:>
Post
'[
J
SON
]
String
:<|>
"echo"
:>
Capture
"string"
Text
:>
Get
'[
J
SON
]
Text
:<|>
"upload"
:>
MultipartForm
MultipartData
:>
Post
'[
J
SON
]
Text
-- :<|> "node" :> Capture "id" Int :> Get '[JSON] Node
...
...
@@ -60,7 +63,7 @@ server conn
startGargantext
::
FilePath
->
IO
()
startGargantext
file
=
do
print
(
"Starting server on port "
++
show
port
)
print
(
"Starting server on port "
<>
show
port
)
param
<-
databaseParameters
file
conn
<-
connect
param
...
...
@@ -90,17 +93,17 @@ nodeAPI conn id
-- | Upload files
-- TODO Is it possible to adapt the function according to iValue input ?
upload
::
MultipartData
->
Handler
String
upload
::
MultipartData
->
Handler
Text
upload
multipartData
=
do
liftIO
$
do
putStrLn
"Inputs:"
forM_
(
inputs
multipartData
)
$
\
input
->
putStrLn
$
" "
++
show
(
iName
input
)
++
" -> "
++
show
(
iValue
input
)
putStrLn
$
" "
<>
show
(
iName
input
)
<>
" -> "
<>
show
(
iValue
input
)
forM_
(
files
multipartData
)
$
\
file
->
do
content
<-
readFile
(
fdFilePath
file
)
putStrLn
$
"Content of "
++
show
(
fdFileName
file
)
++
" at "
++
fdFilePath
file
putStrLn
$
"Content of "
<>
show
(
fdFileName
file
)
<>
" at "
<>
fdFilePath
file
putStrLn
content
pure
"Data loaded"
pure
(
pack
"Data loaded"
)
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