In: Computer Science
URL routing in relation to server-side development. How does it differ from routing physical files?
Answer: Routing is the mechanism by which requests are connected to some code. It is essentially the way we navigate through a website or web-application. By clicking on a link, the URL changes which provides the user with some new data or a new web page.
Server side routing : When browsing, the adjustment of a URL can make a lot of things happen. This will happen regularly by clicking on a link, which in turn will request a new page from the server. This is what we call a server-side route. A whole new document is served to the user.
A server-side request causes the whole page to refresh. This is because a new GET request is sent to the server which responds with a new document, completely discarding the old page altogether.
Advantages :
1. A server-side route will only request the data that’s needed. No more, no less.
2. Because server-side routing has been the standard for a long time, search engines are optimized for web pages that come from the server.
Disadvantages :
1. Every request results in a full-page refresh. That means that unnecessary data is being requested. A header and a footer of a web page often stays the same. This isn’t something you would want to request from the server again.
2. It can take a while for the page to be rendered. However, this is only the case when the document to be rendered is very large or when you have slow internet speed.
This is how URL routing differs in server side than physical files.