Backend
SolidStart
Add Vox to your SolidStart project.
To add the backend integration to your SolidStart project, you need to create a new file src/routes/api/feedback.ts
and add the following code:
import { createFeedbackHandler } from "voxjs/server";
import { createHandler } from "@solidjs/start/server";
import { getSession } from "~/lib/auth";
import { env } from "~/env";
export const POST = createHandler(async ({ request }) => {
const session = await getSession(request); // Your custom auth logic.
if (!session) {
return new Response(JSON.stringify({ error: "Unauthorized" }), {
status: 401,
headers: { "Content-Type": "application/json" },
});
}
return createFeedbackHandler({
apiKey: env.FEEDBACK_KEY, // Your Vox API key.
tags: {
app: "my-app", // Your app name.
user: session.user.email,
},
})(request);
});