Make database connection fully lazy to avoid build-time initialization
This commit is contained in:
1 parent
3169fa815e
commit
e86d4d7d60
8 files changed
+18
-10
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import db from '@/lib/db'
|
||||
import { getDb } from '@/lib/db'
|
||||
import { getStreamUrl } from '@/lib/ytdlp'
|
||||
import { streamCache } from '@/lib/cache'
|
||||
|
||||
@@ -11,6 +11,7 @@ export async function GET(
|
||||
const { id } = await params
|
||||
|
||||
// Get song from database
|
||||
const db = getDb()
|
||||
const song = db.prepare('SELECT * FROM songs WHERE id = ?').get(id) as any
|
||||
|
||||
if (!song) {
|
||||
|
||||
Reference in new issue
Block a user