Next.js API route for creating A/B tests in the Sophra System’s Cortex module
POST
function is the primary export, handling incoming HTTP POST requests for A/B test creation. It accepts a NextRequest
object and returns a Promise<NextResponse>
, aligning with Next.js 14’s API route conventions.
A/B Test Creation Sequence
req.text()
for efficient body parsing, avoiding unnecessary JSON parsing for invalid requests..env
file and accessed via process.env
within the service layer.