The first time cloud functions / serverless functions clicked for me was when I saw and tried Auth0’s (now defunct) Webtask. It was a little CodePen-like IDE but you didn’t really see anything aside from code and logs. The point was to write little bits of Node when you hit the functions URL (that’s literally exactly what a serverless function is). It would even store your secrets for you, meaning that you could use the serverless function as a proxy. You hit the function, the function hits the API using your unexposed API Key secrets, the API returns data, the function then returns data, and that data is available to the client side for you to work with. The entire point was 1) you can snag data from an otherwise totally static website, and 2) your API keys are protected. Brilliant.
I still miss Webtask, but I’m sure there are better and fancier things these days. I don’t have a solid handle on the whole landscape. Even AWS has an online editor for lambdas (a “lambda” is AWS’s standards-setting implementation of what a serverless function is), but using the AWS console directly for anything isn’t usually… very good. Functions in AWS Amplify are probably a better bet there.
My guess is the proper modern way of building these things are things like…
- use Serverless.com’s framework to build/test/deploy your serverless functions
- use Netlify Functions + Netlify Dev
- use Vercel’s Serverless Functions, or Next.js
/pages/apistuff with any Node host, like Heroku
But there are all sorts of other tools that seem pretty modern that I just can’t speak to as well, but seem good:
But what makes me think of all this, and is also in the category of things I don’t have any personal experience with, is Pipedream. I heard about it via Raymond, who has a similar story to mine:
Raymond Camden, “Using Pipedream to Proxy Other APIs”
Pipedream looks pretty fancy:
Not only is it a web-based IDE for crafting functions, but I can trigger it a bunch of ways—a URL of course, but also on a CRON, or things like via email or RSS. Neat. Look at all the other options too. Slack? GitHub? Twitter? It’s kinda like how Zapier looks in that way, only where Zapier is entirely no-code (I think). Pipedream makes code a first-class citizen.
And it does secrets by way of account-level environment variables.
So, it’s perfect for being a serverless proxy. Read Raymond’s post for actual implementation and code examples.
Go to the original Source
Author: Chris Coyier
Powered by WPeMatico