Frontend Routing vs Backend Routing

Maybe you can’t tell the difference at first. Let me break the two down.

Everyone knows you have a client and a server, and the client sends requests to the server, the server responds back with a response to the client. In backend routing, the server handles every request by responding to the client with a code 201(I got that thing you want!) or a 404 (Nope, I don’t have that!).

Let’s say a user fills out a form with his name, address, favorite hobby and sends a POST request by submitting the form. That GET request url is sent to the server and the server serves back the requested url to the client as a static file that is stored on the server. If the server doesn’t have the requested file, then it returns a 404 response error.

Frontend routing is handled from the browser, the framework Angular is a great example. When the browser sends a GET request to the server. In Angular urls are followed by #, and only the url is sent ignoring anything else after a # is detected. The server responses with the defaulted ‘index.html’ and the browser displays the index.html of the requested url. Here’s where it starts changing from backend to frontend. A script runs on the browser and then sees the ‘#’ in the header, so it handles the operation by sending a possible GET request to the server and adds the component to the View while still on index.html.

This is my basic understanding for now, if you would like to comment please leave one :D. I hope you enjoyed my little rant.