chore: inngest explore
This commit is contained in:
parent
9d6841e7fc
commit
249fd63405
10
src/app/api/inngest/route.ts
Normal file
10
src/app/api/inngest/route.ts
Normal 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
4
src/inngest/client.ts
Normal 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
10
src/inngest/functions.ts
Normal 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}!` };
|
||||||
|
}
|
||||||
|
);
|
Loading…
Reference in New Issue
Block a user