How to Write a Netlify Post-Deploy Function in Golang
Create serverless functions to enhance your Netlify website. This video explains how to create a “deploy-succeeded” trigger function in Golang. Stick around till the end of the video where I show some additional details you won’t find in the Netlify documentation.
Netlify functions are AWS Lambda functions that are triggered through Netlify’s naming convention. There are tons of uses for Netlify functions to power up your statically generated website. Works with Astro, Next.js, Nuxt, Gatsby, Eleventy, Hugo, and Jekyll.
Request body as mentioned in the video: https://gist.github.com/gmorse81/e3325aa2137578a71a4b73cbaa49f3b9
My website where this code is in use: https://askcloudarchitech.com
Source code of working example: https://github.com/askcloudarchitech/askcloudarchitech/tree/master/asksitestatic
00:00 – Intro
00:10 – Review Documentation
01:03 – Create the file structure
01:32 – Initialize a Go module
01:55 – Create the main.go file
03:25 – Create types for gathering request body details
04:48 – Unmarshal the request body
05:20 – Create the custom logic
06:15 – Clean up the response output
06:40 – Finish up the module
07:00 – Push the branch on Github
07:10 – A couple extra hints
07:45 – Open a pull request and watch it run
Comments are closed.