Create a webhook that runs code on your laptop via ngrok
Create a NextJS app by running
npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/api-routes-starter"Create
pages/api/user.jswith:
export default function handler(req, res) {
res.status(200).json({ name: "John Doe" });
}In a terminal run
npm run devInstall Ngrok from https://ngrok.com/
In a terminal run
ngrok http 3000Copy the URL output by Ngrok and add
/api/userto the endLog in to https://greenwebhook.netlify.app and create a new webhook.
Paste the URL from step 6 into the destination.
Click Save
Click on the
Invocation URIlink to trigger the webhook.Confirm that the response is
200and contains JSON{ name: "John Doe" }
Currently the Carbon Aware SDK only supports a limited list of locations but when more locations are supported then we will be able to allow you to put in the location where your computer or laptop is running in order to determine if it is the location with the lowest carbon intensity.
Last updated