chore: inngest explore

This commit is contained in:
javayhu 2025-06-24 22:53:40 +08:00
parent 9d6841e7fc
commit 249fd63405
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,10 @@
import { serve } from 'inngest/next';
import { inngest } from '../../../inngest/client';
import { helloWorld } from '../../../inngest/functions';
export const { GET, POST, PUT } = serve({
client: inngest,
functions: [
helloWorld, // <-- This is where you'll always add all your functions
],
});

4
src/inngest/client.ts Normal file
View File

@ -0,0 +1,4 @@
import { Inngest } from 'inngest';
// Create a client to send and receive events
export const inngest = new Inngest({ id: 'my-app' });

10
src/inngest/functions.ts Normal file
View File

@ -0,0 +1,10 @@
import { inngest } from './client';
export const helloWorld = inngest.createFunction(
{ id: 'hello-world' },
{ event: 'test/hello.world' },
async ({ event, step }) => {
await step.sleep('wait-a-moment', '1s');
return { message: `Hello ${event.data.email}!` };
}
);