DEV Community

loading...
Cover image for Middleware: part-3.0

Middleware: part-3.0

Spoorti-Kotrashetti
Python programmer!
Updated on ・2 min read

So, what is a Middleware ???

Middleware is a software that provides common services (also repetitive) to the applications beyond what's offered by the OS (Operating System).

It is the bridge between the Frontend, the Backend, and the OS.

It helps developers to build the application more efficiently.

It is the connective tissue between the application, the data and the users.

Middleware usually runs between the Request- Response cycle (i.e., between the client and the web server).
Request-response cycle

Now, you all must be wondering... "Where is the middleware's role in the project??"

Well, I need to explain this with a couple of example....
Scenario-1
In our hotel website, only the logged-in user can place food orders.
So, if an unregistered user or a user without signing in, tries to place an order.....then, user will automatically be directed to the login page stating "Please login before placing orders!!".
Now..... how did this redirection happen???
Exactly, through the middleware, the authentication middleware.

Scenario-2
When a user types a URL say: "localhost/menu"
But, the URL mentioned in the URL configuration file is "localhost/menu/"
Now... CommonMiddleware takes care of appending the end slash to the URL and rendering the correct template instead of throwing an "URL not found" error.
COOL!!, isn't it?

What happens if NO MIDDLEWARE ???

Yeah...It's not an issue, you can still develop a website without using a middleware, but I would call it a less-efficient style of development.
What I mean is, if you don't want to use a middleware then, you will have to sit writing some repeat codes whenever and wherever required. This some what decreases the efficiency of the developer.

Like....a good engineer's focus should be in delivering a satisfactory product to its customer, in the constrained time (or lesser than the promised time), with a little less complex in the coding work (keeping the Agile Methodology in mind) so that, if a customer needs some add-ons or removal of certain features then, the less code complexity will make it more easier and faster to make the necessary modifications.

Putting it all in a nutshell...
It all started with a small idea of exploring an open-source alternative for Java.
Learning the SDLC and applying it throughout the project process.
Importance and fun of working as a team, right from teaching each other, correcting each other's mistakes to learning from our mistakes...we all made it.
We literally got exposed to many new technologies.
Finally, we developed a website as a POC and justified our thesis of PYTHON being one of the best alternate options for Java.
So yes...this was a pretty much of my learning and experience throughout our "The Middleware Opensource Option/s" project.

Hope you enjoyed the series :)

Will get back with a new one shortly...

Thank you.

Discussion (0)