View on GitHub

reading-notes

Daily Reading 16

Serverless Functions

###

What are the key characteristics of serverless computing, and how does it differ from traditional server-based architectures?

In spite of the name, Serverless computing does not involve an absence of a backend server. However, it does involve essentially no management from the developer’s end for the server side infrastructure concerns, as these are all handled by the people you’re purchasing the server resources from.

A notable example of a serverless computing service would be AWS, amazon web services, in which you rent access to their systems, and are charged based on your usage of their resources. If you’re using no resources, then there is no cost (apart from any existing subscriptions providing you access.)

The term serverless comes from the fact that the developer themselves doesn’t need to have a server set up on their own, and that the server is only used when an active request is made to it, and is otherwise idle.

How can one get started with Vercel, and what are the main steps involved in deploying a serverless function using Vercel?

A serverless function is a function that does not save any data, and only exists to be used once and then destroyed, particularly when in the context of sending a single use request to a waiting serverless… server… to wake up, provide a response, and then sleep again.

Setting up a Vercel account, and registering for a serverless function usage plan is. You will also need the Vercel CLI installed locally, and after that is done, make an api/hello/route.ts file in your app directory. Create your call and response code, then test it locally by emulating a serverside responder that has the response code at the ready.

Changing and updating your app directory via git will automatically deploy your function for you.

What are APIs, and how can they be utilized in Python applications to access and manipulate data from external sources?

Application programming interface. It is a deeper level call and response system for computer systems to communicate with each other, without needing to know the exact specifications and details of each other. Request and Response. computer Alice sends a request for today’s weather in San Francisco to Bob’s weatherdata server. Bob’s server sees the request, and, seeing that it’s formatted correctly and allowed, sends back a request recieved OK signal, followed by the requested data. This is an example of a simple read request, but requests to write or edit are also possible through this system, provided you have the proper clearance!

What is the Requests library in Python, and how can it be used to interact with APIs by sending HTTP requests? Can you provide an example of a basic GET request using the Requests library?

Requests is a python library that vastly simplifies sending out the API Request formatting mentioned above, by turning the complicated details into a simple “get” method that just takes a server URL as an argument. The official documentation for Requests provides an example for using requests.get, by:

` r = requests.get(‘https://api.github.com/events’) ` which would then save the result of the GET request to the variable R for you to then look at or otherwise interact with.

Back To Main Page.