mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
6659cfc8b0
* fix: track event fixes * fix: adding env variables to trubo
23 lines
691 B
TypeScript
23 lines
691 B
TypeScript
import axios from "axios";
|
|
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
const unsplashKey = process.env.UNSPLASH_ACCESS_KEY;
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const { query, page, per_page = 20 } = req.query;
|
|
|
|
const url = query
|
|
? `https://api.unsplash.com/search/photos/?client_id=${unsplashKey}&query=${query}&page=${page}&per_page=${per_page}`
|
|
: `https://api.unsplash.com/photos/?client_id=${unsplashKey}&page=${page}&per_page=${per_page}`;
|
|
|
|
const response = await axios({
|
|
method: "GET",
|
|
url,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
|
|
res.status(200).json(response);
|
|
}
|