Skip to content

Instantly share code, notes, and snippets.

View individual11's full-sized avatar
๐ŸŽƒ
2026

David Vogeleer individual11

๐ŸŽƒ
2026
View GitHub Profile
@individual11
individual11 / javascript-proxy-as-rest-client.js
Created February 8, 2022 21:11 — forked from DavidWells/javascript-proxy-as-rest-client.js
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
return async function(id = "") {
const response = await fetch(`${url}/${key}/${id}`)