This blog is not intend to only show the API of Falcon but take Falcon as an example to demonstrate what’s web framework and what functionality we need in the web framework.
Web frameworks are definitely not a must for building server as we could handle HTTP, TCP, or even IP message manually. But this is definitely not efficient and can even be not effective. Hence, we usually use web frameworks as a toolkit for help.
So what the web framework consist of? The answer comes from the word server.
The name server comes from the server-client model which is fundamental of modern web. Entities on the Internet could be divided into two class, some named client sending requests actively such as we use Google to find resources, the others named server waiting for requests passively, process the request accordingly, and return the resources asked by clients.
So the key functionality of frameworks consist of:
The first challenge of receiving requests is the location. How can a client knows where you are? Similar as mailing, we need some address similar as your email. So we have the IP address to locate the machine, and port to locate the process (Server is a process running on machine).
Like we need to check the mailbox frequently, the server also shall check the box (identified by IP and port) frequently to find incoming requests from clients. This procedure is also called listening.
But frequently checking is not always enough. Imagine Google’s Search Engine, there’ll be billions of requests send from all over the world, so the mailbox will shortly be filled up and crashed. This is why modern web framework usually have advanced algorithms to maintain the “mailbox” efficiently.
Unzip
So now we could get the content of message, but can we directly read the content?
No, this message is very likely to be zipped. As we all know, zip files could reduce the file size. And the reduced file size could make our files to be sent faster and reduce the load of network.