3// Random math fact
4export let mathFact = fetchText(
5 "http://numbersapi.com/random/math"
6);
3// GitHub gists
4export let githubGists = fetchJSON(
5 "https://api.github.com/users/stevekrouse/gists"
6);
1export async function TanaPasteExample(req, res) {
2 // you call this functioin from Tana's make API request
3 // as https://api.val.town/express/@bikefixe.TanaPasteExample?arg=stufftopassin
4 // then you'd call the API where the data you want resides
5 // a search term might've been passed in
6 // const url = https://something@domain.com?searchterm=${req.query.arg}
17 };
18 // then build a string in Tana Paste format.
19 // if you're working from a Make API request command,
20 // then the %%tana%% header isn't required
21 const outputString = `- ${dummy.name} #mysupertag
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export let getMe = fetchJSON(`https://api.val.town/v1/me`, {
5 headers: {
6 Authorization: `Bearer ${process.env.valtownToken}`,
1export let heapify = (arr) => {
2 // maxHeap
3 const swapDown = (arr, n, i) => {
8 const d = params.get("d");
9 const resData = await fetchJSON(
10 `https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=${symbol}&interval=${d}min&apikey=${process.env.alphaVantage}`,
11 );
12 const data = {
1export function myApi(name) {
2 return "hi " + name;
3}
8 long: number;
9}) {
10 // Get date and API key
11 const now = new Date();
12 const apiKey = process.env.WEATHER_BIT_API_KEY;
13 if (!apiKey) {
14 throw new Error("Must define WEATHER_BIT_API_KEY in secrets");
15 }
16 const res = await fetch(
17 `https://api.weatherbit.io/v2.0/current/airquality?lat=${lat}&lon=${long}&key=${apiKey}`,
18 );
19 const jsonObj = await res.json();