14 lines
471 B
TypeScript
14 lines
471 B
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
import axios from 'axios';
|
|
import { baseURLApi } from '../../../config';
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
try {
|
|
const { data } = await axios.get(`${baseURLApi}/pexels/image`);
|
|
res.status(200).json(data);
|
|
} catch (error) {
|
|
console.error('Error proxying pexels image:', error);
|
|
res.status(500).json({ error: 'Error fetching image' });
|
|
}
|
|
}
|