Using Zeit for Serverless
-
Kelsey Hightower mentioned Zeit last year and I've been meaning to look into it. It's a pretty awesome serverless platform.
I didn't use their now client, I just added a repo to Zeit and it manages the build and deployment for me.
Here's a link to the repo: https://gitlab.com/hooksie1/zeit-test
This was written in Go. Using Go you just need an exported Function and take the
http.responseWriterand thehttp.Request. Then do you work on the payload and return the info.Here's the URL for the endpoint: https://goniq.hooks.technology/api/test
You can test it by giving it a list of strings and it will return only the unique strings. For example:
curl -X POST https://goniq.hooks.technology/api/test -d '{"list": ["testing","testing2","testing3","testing2", "mangolassi", "mangolassi"]}'It will return this data for you:
["testing","testing2","testing3","mangolassi"] -
To fully have this running it took around 15-20 minutes. Most of that was me being an idiot. The account set up was quick, I just made a repo and then took too long to write some simple code. I pushed it up and it built and deployed for me.
-
You can include a package.json to specify build parameters. But I just had it use the defaults.
-
Oh is this another static website service?
-
@jmoore said in Using Zeit for Serverless:
Oh is this another static website service?
No this is a serverless platform. Like AWS Lambda, GCP Cloud Functions, Azure Functions, etc.
-
I just changed the URL to reflect the subdomain I created.
-
Oh I see. Will have to check that out too then. Thanks!