Serverless is one hot topic in the dev world especially during the last couple of years. As per the name suggests, Serverless is a way of deploying endpoints aka functions without having to deal with the server or hardware they run on.

Not having to worry about servers makes it a really cost effective model as it we only pay for the time our functions are being executed. If our APIs only run for e.g 30 hours per month then we are going to pay only for these 30 hours instead of the time where the server sits idle which is 24 hours per day for the whole month.

Apart from the cost benefits, Serverless also makes it easy for us to deal with peak traffic with its auto scaling model. These are really good reasons for us to start using Serverless ASAP.

Signup for Cloudflare Workers

You can go and sign up at https://workers.cloudflare.com/. Their generous free tier provides us with 100,000 read operations per day!!! I don’t know about you, but for me this number is a lot more than enough for my side projects.

I mean even if you want to use their paid plan it’s $5 for 1,000,000 requests per month. Choose whichever plan works for you and then let’s go and write some code.

Installing the CLI tools

Now that we have an account first thing to do is to install the CLI tools. For this example we are going to use the JS client. Let’s install wrangler globally.

npm install -g @cloudflare/wrangler

Now that we have wrangler installed, we can see that it provides us with a number of things we can do with it. Now let’s login to our account

Powered by Fruition