1
2
3
4
5
6
7
8
9
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20";
const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");
proxyURL.searchParams.set("url", url);
// console.debug("proxyUrl: %s", proxyURL);
// ==> proxyUrl: https://unsecure-fetch.val-town.workers.dev/?url=https%3A%2F%2Fassignment-api.uspto.gov%2Fpatent%2FbasicSearch%3Fquery%3D1234567%26fields%3Dmain%26rows%3D20
console.log(await fetchText(proxyURL.href));