inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
369 stars 37 forks source link

Add integration with Qwik #486

Open hckhanh opened 4 months ago

hckhanh commented 4 months ago

Is your feature request related to a problem? Please describe.

I think that Qwik integration should be added

hckhanh commented 4 months ago

I leave the wrapper here for someone needs it

import type { RequestHandler } from '@builder.io/qwik-city'

import { serve } from 'inngest/cloudflare'

import {
  createSkillIndex,
  deleteSkillIndex,
  createPostIndex,
  deletePostIndex,
} from '~/inngest/functions'
import inngest from '~/inngest'

const inngestRequest = serve({
  client: inngest,
  streaming: 'allow',
  signingKey: import.meta.env.VITE_INNGEST_SIGNING_KEY,
  functions: [createPostIndex, deletePostIndex, createSkillIndex, deleteSkillIndex],
})

const onRequest: RequestHandler = async ({ send, request, platform }) => {
  const response = await inngestRequest({
    request,
    env: platform.env as Record<string, undefined | string>,
  })
  send(response)
}

export const onGet = onRequest

export const onPost = onRequest

export const onPut = onRequest