Back to packages list

Vals using pexels

Description from the NPM package:
The official Pexels API Javascript client.
Fork
1
2
3
4
5
6
7
8
9
10
11
import { html } from "https://esm.town/v/stevekrouse/html";
import { createClient } from "npm:pexels";
export async function pexelsExample(request: Request): Promise<Response> {
const pexels = createClient(Deno.env.get("pexels"));
const r = await pexels.photos.search({ query: "singapore skyline" });
if (!("photos" in r)) return;
return html(
r.photos.map(p => `<img width="50px" src="${p.src.tiny}"/>`).join(""),
);
}
1
Next