Allow user to share a flow publicly and make it duplicatable

Closes #360
This commit is contained in:
Baptiste Arnaud
2023-11-23 12:05:31 +01:00
parent 8a07392821
commit bb41226a04
130 changed files with 1150 additions and 2012 deletions

View File

@@ -0,0 +1,24 @@
import { createContext } from '@/helpers/server/context'
import * as Sentry from '@sentry/nextjs'
import { NextApiRequest, NextApiResponse } from 'next'
import { createOpenApiNextHandler } from 'trpc-openapi'
import cors from 'nextjs-cors'
import { publicRouter } from '@/helpers/server/routers/publicRouter'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
await cors(req, res, {
origin: ['https://docs.typebot.io', 'http://localhost:3000'],
})
return createOpenApiNextHandler({
router: publicRouter,
createContext,
onError({ error }) {
if (error.code === 'INTERNAL_SERVER_ERROR') {
Sentry.captureException(error)
console.error('Something went wrong', error)
}
},
})(req, res)
}
export default handler