Overview
Server handlers are framework-agnostic handlers that run on your backend to manage protocol operations that require server-side logic.
Handlers are compatible with any server framework that supports the:
- Fetch API, and is exposed via the
Handler#fetchfunction - Node.js
RequestListenerAPI, and is exposed via theHandler#listenerfunction
import { Handler } from 'tempo.ts/server'
import { account, client } from './config'
const handler = Handler.feePayer({
account,
client,
feeToken: '0x20c0…0001'
path: '/fee-payer',
})
createServer(handler.listener) // Node.js
Bun.serve(handler) // Bun
Deno.serve(handler) // Deno
app.all('*', c => handler.fetch(c.request)) // Elysia
app.use(handler.listener) // Express
app.use(c => handler.fetch(c.req.raw)) // Hono
export const GET = handler.fetch // Next.js
export const POST = handler.fetch // Next.js