Skip to content

Instantly share code, notes, and snippets.

View ilmpc's full-sized avatar
🦩

Mark Chigrin ilmpc

🦩
View GitHub Profile
const mergeArgs = (savedArgs, args, i = 0) =>
savedArgs.map((e) => {
if (e === curry.placeholder && i < args.length) {
return args[i++];
}
return e;
});
const curry =
(
@ilmpc
ilmpc / openapi.json
Created December 28, 2022 11:57
Deel staging server openapi
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.1",
"info": {
"title": "Deel REST API",
"contact": {
"name": "Deel API Team",
"email": "apiteam@deel.com"
},
"termsOfService": "https://www.letsdeel.com/terms-of-service",
"version": "1.15.7"
@ilmpc
ilmpc / [[path]].js
Created October 30, 2022 10:10
Cloudflare function for api proxing
// The URL for the remote third party API you want to fetch from
// but does not implement CORS
const API_URL = 'https://api.example.com/api/';
export const onRequest = async (context) => {
const url = context.request.url.replace(/https?:\/\/.+?\/api\//gi, API_URL);
// Rewrite request to point to API URL. This also makes the request mutable
// so you can add the correct Origin header to make the API server think
// that this request is not cross-site.