What Makes Express Fall In The Category Of Framework Instead Of Web Server?
Solution 1:
First off, Express isn't a web server. It does not have its own web server code.
It can either create a standard node.js http
server for you (when you do app.listen()
or you can create your own http
or https
server and pass it to Express as part of the setup.
Instead, it's a "framework on top of a web server". It provides a general purpose mechanism for defining routes and middleware, error handlers and template renderers (and other things).
As an indication of this, there are tons of NPM add-ons that plug-in to your web server via the Express middleware or Express routing mechanism or rendering APIs (they plug into the framework in a standard way). This means of plugging in via a standard mechanism is, in my opinion, what makes it a framework.
So, whereas Apache is actually a web server itself, Express is a layer that runs on top of the web server that is already built into node.js.
It's certainly not a general purpose programming framework, but a very specific type of web server framework.
From WikiPedia's page for "Software framework":
In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software. A software framework provides a standard way to build and deploy applications. A software framework is a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products and solutions
Evaluating Express against this definition, it gets checkmarks for all these elements:
✔ Abstraction providing generic functionality
✔ can be selectively changed by additional user-written code
✔ thus providing application-specific software
✔ A software framework provides a standard way to build and deploy applications
✔ A software framework is a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products and solutions
"applications" in this case is a node.js web server.
Post a Comment for "What Makes Express Fall In The Category Of Framework Instead Of Web Server?"