Creating functions
Functions are endpoints that can later be called on the client.
call
To create new functions (endpoints), use .call
on any middleware.
import { all } from "kavi/server"
export const router = {
// the "all" middleware runs before every call
route: all.call(() => {
// runs on each request
}),
}
To see how it's used check out First Api.
Calling functions
clientimport { api } from "$lib/kavi/client"
await api.route().ok()
calling the function returns a result.