Simply write, test and deploy your Edge Functions with Azion Funcs
npm i -g azion-funcs
yarn add -g azion-funcs
1. Create project
azion new <PROJECT_NAME>
Then edge-azion will automatically create a project with the following:
functions/
helloworld.js
azion.config
3. Write your Function
// functions/myFunction.js
async function handleRequest(request) {
return new Response("Hello, Azion!");
}
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request))
})
3. Setup your Edge Applications
# ./azion.config
azion:
user: "user@domain.com"
password: "password"
domain:
name: "My domain"
application:
name: "My Application"
function:
name: "My Function"
file: "myFunction.js"
see complete config documentation
4. Deploy it
azion deploy