Skip to content

Commit 17079d6

Browse files
committed
Make example app a little easier to run
1 parent 9168500 commit 17079d6

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

app/Main.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import Data.Aeson as A
99
import Data.Aeson.TH as A hiding (Options)
1010
import Data.Aeson.TypeScript.TH
1111
import Data.Proxy
12+
import Data.String.Interpolate
1213
import Servant.API
1314
import Servant.TypeScript
15+
import System.IO.Temp
1416

1517

1618
data User = User {
@@ -24,4 +26,8 @@ type UserAPI = "users" :> Get '[JSON] [User]
2426
:<|> "albert" :> Get '[JSON] User
2527
:<|> "isaac" :> Get '[JSON] User
2628

27-
main = writeTypeScriptLibrary (Proxy @UserAPI) "/tmp/test"
29+
main = do
30+
tmpDir <- getCanonicalTemporaryDirectory
31+
dir <- createTempDirectory tmpDir "servant-typescript-example"
32+
writeTypeScriptLibrary (Proxy @UserAPI) dir
33+
putStrLn [i|Wrote TypeScript library to: #{dir}|]

package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ executables:
6161
- -with-rtsopts=-N
6262
dependencies:
6363
- servant-typescript
64+
- temporary
6465

6566
tests:
6667
servant-typescript-test:

servant-typescript.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 1.12
22

3-
-- This file has been generated from package.yaml by hpack version 0.34.4.
3+
-- This file has been generated from package.yaml by hpack version 0.37.0.
44
--
55
-- see: https://github.com/sol/hpack
66

@@ -94,6 +94,7 @@ executable servant-typescript-exe
9494
, servant-foreign
9595
, servant-typescript
9696
, string-interpolate
97+
, temporary
9798
, text
9899
default-language: Haskell2010
99100

0 commit comments

Comments
 (0)