Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

ReScript RPC like?

$
0
0

Something like this:

// Contract.res
let getPost = Rest.rpc(() => {
  input: S.string,
  output: postSchema
})

// Client.res
let post = await Contract.getPost->Rest.fetch(url, "post_1")

// Server.res
app->Hono.route(Contract.getPost, async ({input: postId}) => {
    posts->Dict.getUnsafe(postId)
}

What do you think?


Viewing all articles
Browse latest Browse all 2592

Trending Articles