Skip to content

Commit 8f76008

Browse files
committed
Add build-id/route.ts
1 parent c15934f commit 8f76008

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

web/pages/api/build-id/route.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import path from 'path';
2+
import fs from 'fs';
3+
4+
export default function handler(req: any, res: any) {
5+
const buildId = fs.readFileSync(path.join(process.cwd(), '.next', 'BUILD_ID'), 'utf8').trim();
6+
res.setHeader('Cache-Control', 's-maxage=31536000, stale-while-revalidate');
7+
res.status(200).json({ buildId });
8+
}

0 commit comments

Comments
 (0)