What is the difference between a web server and a web framework?
20th January 2012
My answer to What is the difference between a web server and a web framework? on Quora
A “web framework” offers a set of APIs for writing your own custom code in such a way that it can be called via the Web. Usually a framework will deal with common details such as HTTP header parsing, URL routing and so forth.
A web server is a piece of software which listens on a network port for incoming HTTP requests and responds to them. Most web servers have a default mode where they will interpret the incoming request as a path on the filesystem and return the file at that path, but they can usually be configured to do something else with the request instead (pass it to a CGI script, proxy it to another server, run some custom module code etc).
If you squint at Apache or nginx (commonly referred to as web servers) you might be able to describe them as web frameworks as well, since both offer extensive configuration options and a C module API for writing custom code. Most people won’t call them that though.
Likewise, if you consider node.js to be a framework (which I think is a reasonable interpretation, but others may disagree with me) you could also consider it a web server, since it comes with a reasonably robust HTTP server implementation that can be started using a single function call.
The problem here is really that the concept of a “web framework” doesn’t lend itself to a rock-tight definition.
I imagine this answer is more confusing than it is helpful, for which I apologise.
More recent articles
- Weeknotes: Getting ready for NICAR - 27th February 2024
- The killer app of Gemini Pro 1.5 is video - 21st February 2024
- Weeknotes: a Datasette release, an LLM release and a bunch of new plugins - 9th February 2024
- LLM 0.13: The annotated release notes - 26th January 2024
- Weeknotes: datasette-test, datasette-build, PSF board retreat - 21st January 2024
- Talking about Open Source LLMs on Oxide and Friends - 17th January 2024
- Publish Python packages to PyPI with a python-lib cookiecutter template and GitHub Actions - 16th January 2024
- What I should have said about the term Artificial Intelligence - 9th January 2024
- Weeknotes: Page caching and custom templates for Datasette Cloud - 7th January 2024