Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
import type { SanitizedConfig } from '../config/types.js';
|
|
/**
|
|
* Attaches the Payload REST API to any backend framework that uses Fetch Request/Response
|
|
* like Next.js (app router), Remix, Bun, Hono.
|
|
*
|
|
* ### Example: Using Hono
|
|
* ```ts
|
|
* import { handleEndpoints } from 'payload';
|
|
* import { serve } from '@hono/node-server';
|
|
* import { loadEnv } from 'payload/node';
|
|
*
|
|
* const port = 3001;
|
|
* loadEnv();
|
|
*
|
|
* const { default: config } = await import('@payload-config');
|
|
*
|
|
* const server = serve({
|
|
* fetch: async (request) => {
|
|
* const response = await handleEndpoints({
|
|
* config,
|
|
* request: request.clone(),
|
|
* });
|
|
*
|
|
* return response;
|
|
* },
|
|
* port,
|
|
* });
|
|
*
|
|
* server.on('listening', () => {
|
|
* console.log(`API server is listening on http://localhost:${port}/api`);
|
|
* });
|
|
* ```
|
|
*/
|
|
export declare const handleEndpoints: ({ basePath, config: incomingConfig, path, payloadInstanceCacheKey, request, }: {
|
|
basePath?: string;
|
|
config: Promise<SanitizedConfig> | SanitizedConfig;
|
|
/** Override path from the request */
|
|
path?: string;
|
|
payloadInstanceCacheKey?: string;
|
|
request: Request;
|
|
}) => Promise<Response>;
|
|
//# sourceMappingURL=handleEndpoints.d.ts.map |