ollama/web/app/api/signup/route.ts

28 lines
531 B
TypeScript
Raw Normal View History

import { Analytics } from '@segment/analytics-node'
import { v4 as uuid } from 'uuid'
const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '<empty>' })
export async function POST(req: Request) {
const { email } = await req.json()
2023-07-19 23:11:56 +00:00
const id = uuid()
await analytics.identify({
anonymousId: id,
traits: {
email,
},
})
2023-07-19 23:11:56 +00:00
await analytics.track({
anonymousId: id,
event: 'signup',
properties: {
email,
},
})
return new Response(null, { status: 200 })
}