Check this tweet by Chris Johnson: it’s a tweet with a link whose preview image shows the actual number of retweets and likes for said tweet. A meta tweet.https://t.co/lvaYUszJaE — Chris Johnson (@defaced) January 25, 2022 Cool! In a later tweet, Chris shares how it’s done: How this works!👷♀️ A @Cloudflare worker responds to requests …
Tag Archives: cloud functions
How CodePen leverages Cloudflare Workers and Cloudflare KV Storage
Interesting to see Chris Coyier and Stephen Shaw lift the hood of CodePen, detailing how they use Cloudflare Workers and Cloudflare’s KV Storage. Cloudflare workers are like serverless functions that always run at the edge, making them incredibly fast. Not only that, but the tooling around them is really nice. They can run at particular …
Continue reading “How CodePen leverages Cloudflare Workers and Cloudflare KV Storage”
Miniflare — Fully-local simulator for Cloudflare Workers
Miniflare is a simulator for developing and testing Cloudflare Workers. Originally started as an open-source project, Miniflare has been adopted by Cloudflare to become part of their ecosystem. Installation per NPM: npm install -g miniflare CLI usage is really simple, and is highly configurable using one of its many flags: $ miniflare worker.js [mf:inf] Worker …
Continue reading “Miniflare — Fully-local simulator for Cloudflare Workers”
Cloud Function to generate SVG Sparklines
Zach Leat recently created a cloud function that dynamically generates sparklines. Under the hood sits the the sparkline-svg package to generate the SVG. The datapoints themselves can be passed in via the URL. Image URLs have the formats: /[height]x[width]/[values]/ /[height]x[width]/[values]/[color]/ The code is meant to be deployed as a Netlify Serverless Function. Every Fire needs …
Continue reading “Cloud Function to generate SVG Sparklines”
PHP Cloud Functions on Google Cloud Platform with “Functions Framework for PHP”
Google Cloud Platform has launched official support for PHP Cloud Functions using Functions Framework for PHP. With it, an HTTP Cloud Function becomes as simple as this: use Psr\Http\Message\ServerRequestInterface; function helloHttp(ServerRequestInterface $request): string { $queryString = $request->getQueryParams(); $name = $queryString['name'] ?? $name; return sprintf('Hello, %s!', $name); } Functions that respond to Cloud Events can work …
Continue reading “PHP Cloud Functions on Google Cloud Platform with “Functions Framework for PHP””
Azure Functions Custom Handlers
Baller addition (in preview) to Azure Functions: Azure Functions offers first-class support for a limited number of languages. Now in preview, register custom handlers by providing a lightweight HTTP server in any desired language. Use this new capability to extend the language support for your applications, enabling the use of languages or language versions not …
google/cloud-functions-framework
– Google Cloud Functions Framework for PHP
google/cloud-functions-framework is an open source FaaS (Function as a Service) Framework for writing portable PHP functions. An example function looks like this: <?php use Symfony\Component\HttpFoundation\Request; function helloHttp(Request $request) { return "Hello World from PHP HTTP function!" . PHP_EOL; } One can invoke it locally by executing the included router as follows: export FUNCTION_TARGET=helloHttp export FUNCTION_SIGNATURE_TYPE=http …
Continue reading “google/cloud-functions-framework
– Google Cloud Functions Framework for PHP”
Bref – Serverless PHP Functions on AWS
Bref comes as a Composer package and helps you deploy PHP applications to AWS and run them on AWS Lambda. Bref uses the Serverless framework to configure and deploy serverless applications. Being the most popular tool, Serverless comes with a huge community, a lot of examples online and a simple configuration format. After installing an …
A Netlify Serverless Function in one Tweet
Your first serverless function in one tweet: 1. Save this as `functions/my-first-function.js`: exports.handler = async () => ({ statusCode: 200, body: 'boop',}); 2. Deploy to Netlify3. Call it at <your site>/.netlify/functions/my-first-functionhttps://t.co/cRgT9Yxbmy — Netlify (@Netlify) December 20, 2019 This is cgi-bin all over again, right? 💡 Looking to deploy a website to Netlify? You can find …
Continue reading “A Netlify Serverless Function in one Tweet”