Functions
Functions are endpoints that can be called on the client.
call
To create new functions (endpoints)—use .call
on any middleware.
serverimport { all } from "kavi/server"
export const router = {
// the "all" middleware runs before every call
route: all.call(() => {
// runs on each request
}),
}
To see how—check out Example.
Calling functions
API functions can be called on both client and server.
clientimport { api } from "$lib/kavi/client"
await api.route().ok()
calling the function returns a result.