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: the Datasette Cloud API, a podcast appearance and more - 1st October 2023
- Things I've learned about building CLI tools in Python - 30th September 2023
- Talking Large Language Models with Rooftop Ruby - 29th September 2023
- Weeknotes: Embeddings, more embeddings and Datasette Cloud - 17th September 2023
- Build an image search engine with llm-clip, chat with models with llm chat - 12th September 2023
- LLM now provides tools for working with embeddings - 4th September 2023
- Datasette 1.0a4 and 1.0a5, plus weeknotes - 30th August 2023
- Making Large Language Models work for you - 27th August 2023
- Datasette Cloud, Datasette 1.0a3, llm-mlc and more - 16th August 2023
- How I make annotated presentations - 6th August 2023