Milestone 3: RPC server, ZIP-320 #104
2 changed files with 5 additions and 5 deletions
|
@ -19,5 +19,5 @@ main = do
|
|||
nodePort <- require config "nodePort"
|
||||
let myConfig = Config dbFilePath zebraHost zebraPort nodeUser nodePwd nodePort
|
||||
let ctx = authenticate myConfig :. EmptyContext
|
||||
run 8081 $
|
||||
run nodePort $
|
||||
serveWithContext (Proxy :: Proxy ZenithRPC) ctx (zenithServer myConfig)
|
||||
|
|
|
@ -25,9 +25,9 @@ import Zenith.Types
|
|||
)
|
||||
|
||||
type ZenithRPC
|
||||
= "status" :> Get '[ JSON] Value :<|> ReqBody '[ JSON] RpcCall :> Post
|
||||
= "status" :> Get '[ JSON] Value :<|> BasicAuth "zenith-realm" Bool :> ReqBody
|
||||
'[ JSON]
|
||||
(RpcResponse Value)
|
||||
RpcCall :> Post '[ JSON] (RpcResponse Value)
|
||||
|
||||
zenithServer :: Config -> Server ZenithRPC
|
||||
zenithServer config = getinfo :<|> handleRPC
|
||||
|
@ -39,8 +39,8 @@ zenithServer config = getinfo :<|> handleRPC
|
|||
[ "version" .= ("0.7.0.0-beta" :: String)
|
||||
, "network" .= ("testnet" :: String)
|
||||
]
|
||||
handleRPC :: RpcCall -> Handler (RpcResponse Value)
|
||||
handleRPC req =
|
||||
handleRPC :: Bool -> RpcCall -> Handler (RpcResponse Value)
|
||||
handleRPC isAuth req =
|
||||
case method req of
|
||||
UnknownMethod ->
|
||||
return $
|
||||
|
|
Loading…
Reference in a new issue