mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-25 10:02:27 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
19 lines
590 B
TypeScript
19 lines
590 B
TypeScript
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
export default function handler(req: any, res: any) {
|
|
res.setHeader('Access-Control-Allow-Origin', '*')
|
|
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS')
|
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
|
|
|
|
if (req.method === 'OPTIONS') {
|
|
// Handle preflight
|
|
res.status(200).end()
|
|
return
|
|
}
|
|
|
|
const buildId = fs.readFileSync(path.join(process.cwd(), '.next', 'BUILD_ID'), 'utf8').trim()
|
|
res.setHeader('Cache-Control', 's-maxage=31536000, stale-while-revalidate')
|
|
res.status(200).json({buildId})
|
|
}
|