inngest
Version:
Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.
68 lines (66 loc) • 1.98 kB
text/typescript
import { SupportedFrameworkName } from "./types.cjs";
import { ServeHandlerOptions } from "./components/InngestCommHandler.cjs";
import http from "node:http";
//#region src/node.d.ts
/**
* The name of the framework, used to identify the framework in Inngest
* dashboards and during testing.
*/
declare const frameworkName: SupportedFrameworkName;
/**
* Serve and register any declared functions with Inngest, making them available
* to be triggered by events.
*
* @example Serve Inngest functions on all paths
* ```ts
* import { serve } from "inngest/node";
* import { inngest } from "./src/inngest/client";
* import myFn from "./src/inngest/myFn"; // Your own function
*
* const server = http.createServer(serve({
* client: inngest, functions: [myFn]
* }));
* server.listen(3000);
* ```
*
* @example Serve Inngest on a specific path
* ```ts
* import { serve } from "inngest/node";
* import { inngest } from "./src/inngest/client";
* import myFn from "./src/inngest/myFn"; // Your own function
*
* const server = http.createServer((req, res) => {
* if (req.url.start === '/api/inngest') {
* return serve({
* client: inngest, functions: [myFn]
* })(req, res);
* }
* // ...
* });
* server.listen(3000);
* ```
*
* @public
*/
declare const serve: (options: ServeHandlerOptions) => http.RequestListener;
/**
* EXPERIMENTAL - Create an http server to serve Inngest functions.
*
* @example
* ```ts
* import { createServer } from "inngest/node";
* import { inngest } from "./src/inngest/client";
* import myFn from "./src/inngest/myFn"; // Your own function
*
* const server = createServer({
* client: inngest, functions: [myFn]
* });
* server.listen(3000);
* ```
*
* @public
*/
declare const createServer: (options: ServeHandlerOptions) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
//#endregion
export { createServer, frameworkName, serve };
//# sourceMappingURL=node.d.cts.map