mirror of
https://gitlab.com/foxixus/neomovies.git
synced 2025-10-28 01:48:50 +05:00
20 lines
515 B
TypeScript
20 lines
515 B
TypeScript
|
|
import { NextResponse } from 'next/server';
|
||
|
|
|
||
|
|
export async function GET(request: Request) {
|
||
|
|
const { searchParams } = new URL(request.url);
|
||
|
|
const page = searchParams.get('page') || '1';
|
||
|
|
|
||
|
|
const response = await fetch(
|
||
|
|
`https://api.themoviedb.org/3/movie/upcoming?page=${page}`,
|
||
|
|
{
|
||
|
|
headers: {
|
||
|
|
'Authorization': `Bearer ${process.env.TMDB_ACCESS_TOKEN}`,
|
||
|
|
'Content-Type': 'application/json',
|
||
|
|
},
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
const data = await response.json();
|
||
|
|
return NextResponse.json(data);
|
||
|
|
}
|