Shy
Shy
Explore posts from servers
CDCloudflare Developers
Created by Shy on 12/10/2024 in #workers-help
How can I know if I have done RPC correctly?
right now I have configured elysia's rpc eden to use the service binding from cloudflare workers like so
import type { App } from "@acme/api"
import { edenTreaty } from "@elysiajs/eden"

export const createEden = (apiWorker: Fetcher) => {
return edenTreaty<App>("http://localhost:8787", { fetcher: apiWorker.fetch.bind(apiWorker) })
}
import type { App } from "@acme/api"
import { edenTreaty } from "@elysiajs/eden"

export const createEden = (apiWorker: Fetcher) => {
return edenTreaty<App>("http://localhost:8787", { fetcher: apiWorker.fetch.bind(apiWorker) })
}
await event.locals.api.users[event.locals.session.userId].get().then(
({ data, error }) => error ? err(error.status, error.message) : data)
await event.locals.api.users[event.locals.session.userId].get().then(
({ data, error }) => error ? err(error.status, error.message) : data)
I would like to clear any doubts in my mind, doesn't Service bindings workers work like an rpc? why there is an http method and a rpc method aren't they both rpc's? why is the rpc one preferred over the http method and is there a way to confirm that a request went through a service binding rather than over the network? sorry for too many questions
1 replies