Complete Next.js application for managing OBS Source Switcher - Stream management with multiple screen layouts - Team management CRUD operations - SQLite database integration - OBS WebSocket API integration - Updated to latest versions (Next.js 15.4.1, React 19.1.0, Tailwind CSS 4.0.0) - Enhanced .gitignore for privacy and development
18 lines
555 B
TypeScript
18 lines
555 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { getDatabase } from '../../../lib/database';
|
|
import { Stream } from '@/types';
|
|
import { TABLE_NAMES } from '../../../lib/constants';
|
|
|
|
export async function GET() {
|
|
try {
|
|
const db = await getDatabase();
|
|
const streams: Stream[] = await db.all(`SELECT * FROM ${TABLE_NAMES.STREAMS}`);
|
|
return NextResponse.json(streams);
|
|
} catch (error) {
|
|
console.error('Error fetching streams:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch streams' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|