Generate the browser contract from ProductApi
This commit is contained in:
parent
67cc0cb802
commit
c9642f4067
1 changed files with 2572 additions and 130 deletions
19
app/GenerateContract.hs
Normal file
19
app/GenerateContract.hs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module Main (main) where
|
||||
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import qualified Data.Text.IO as TIO
|
||||
import Nuthatch.Http.Contract
|
||||
( renderContractFixtures
|
||||
, renderTypeScriptContract
|
||||
)
|
||||
import System.Environment (getArgs)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
arguments <- getArgs
|
||||
case arguments of
|
||||
[contractOutput, fixtureOutput] -> do
|
||||
TIO.writeFile contractOutput renderTypeScriptContract
|
||||
BL.writeFile fixtureOutput renderContractFixtures
|
||||
_ -> fail
|
||||
"usage: nuthatch-generate-web-contract CONTRACT_OUTPUT FIXTURE_OUTPUT"
|
||||
Loading…
Reference in a new issue