1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { email } from "https://esm.town/v/std/email?v=9";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const email_apod = (async () => {
const marked = await import("npm:marked");
const apod = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
const output = `
<h1> ${apod.title}</h1>
<p>${apod.explanation}</p>
<img src="${apod.url}" />
`;
const res = await email({
subject: `APOD: ${apod.title}`,
html: output,
});
return res;
})();
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
November 3, 2023