Install once, authenticate with your API token, and ship JavaScript functions fast.
microfn create weather ./src/main.ts
microfn execute alice/weather '{"city":"tokyo"}'
cat main.ts | microfn push alice/weather -
microfn --output json info alice/weather
Install globally with npm:
npm install -g microfn
Both microfn
and mfn
are available.
microfn --help
mfn --help
Set your API token once:
export MICROFN_API_TOKEN="mfn_your_token_here"
Or pass it directly for one command:
microfn --token mfn_xxx list
Create tokens at microfn.dev/users/settings/api
1) Create and inspect
microfn create my-function ./src/main.ts
microfn list
microfn info yourname/my-function
microfn code yourname/my-function
2) Run with input
microfn execute yourname/my-function '{"name":"world"}'
echo '{"name":"world"}' | microfn execute yourname/my-function -
microfn execute yourname/my-function '{}' --include-logs
3) Update and script
microfn push yourname/my-function ./src/main.ts
cat main.ts | microfn push yourname/my-function -
microfn --output json info yourname/my-function
export async function main(input) {
const { city = "tokyo" } = input || {};
const res = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=3`);
return { weather: await res.text() };
}
We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect