|
@@ -3,6 +3,7 @@ import express from 'express';
|
|
|
import cors from 'cors';
|
|
import cors from 'cors';
|
|
|
import path from 'path';
|
|
import path from 'path';
|
|
|
import cookieParser from 'cookie-parser';
|
|
import cookieParser from 'cookie-parser';
|
|
|
|
|
+import { bigintToNumber } from './lib/prisma';
|
|
|
|
|
|
|
|
import authRoutes from './routes/auth';
|
|
import authRoutes from './routes/auth';
|
|
|
import projectRoutes from './routes/projects';
|
|
import projectRoutes from './routes/projects';
|
|
@@ -51,6 +52,12 @@ app.use('/api/settings', settingsRoutes);
|
|
|
app.use('/api/share', shareRoutes);
|
|
app.use('/api/share', shareRoutes);
|
|
|
app.use('/api/folders', folderRoutes);
|
|
app.use('/api/folders', folderRoutes);
|
|
|
|
|
|
|
|
|
|
+// ── BigInt-safe res.json() — patch Response prototype ─────────────────────────
|
|
|
|
|
+// Adding toJSON to BigInt prototype auto-converts BigInt → Number in JSON.stringify
|
|
|
|
|
+// This works because Express uses JSON.stringify internally for res.json()
|
|
|
|
|
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
+(BigInt.prototype as any).toJSON = function () { return Number(this); };
|
|
|
|
|
+
|
|
|
// ── 404 handler ─────────────────────────────────────────────────────────────
|
|
// ── 404 handler ─────────────────────────────────────────────────────────────
|
|
|
app.use((_req, res) => {
|
|
app.use((_req, res) => {
|
|
|
res.status(404).json({ error: 'Not found' });
|
|
res.status(404).json({ error: 'Not found' });
|