Open source Edge Application runtime
npm install @fly/v8envThese are API docs for the Fly runtime JavaScript environment. The runtime implements portions of standard web APIs (like fetch), and additional APIs for doing Fly specific operations.
``javascript`
fly.http.respondWith(function(request){
return new Response("Hello! We support whirled peas.", { status: 200})
})
// if you'd prefer to be service worker compatibility, this is also supported:
// around addEventListener('fetch', function(event){})
functionThe fetch function is available within Fly apps for making HTTP requests.
`javascript`
fly.http.respondWith(async function(req){
const resp = await fetch("http://example.com")
resp.headers.set("fly-ified", "darn tootin'")
return resp
})
It's an enhanced version of the standard Web API fetch function.
* fly/cache: a regional, in memory cache for low latency reads/writes
* fly/data: a global persistent key/value store for permanent data
* fly/image: Image manipulation APIs
* fly/fetch`: libraries for routing and proxying fetch requests
For more documentation, check out the Fly runtime API docs here: https://fly.io/docs/apps/api/index.html