The difference between front-end routing and back-end routing

The difference between front-end routing and back-end routing

1. What routing?
 Routing is to display different content or pages according to different URL addresses;
 
2. What is front-end routing?
Display different front-end components according to different Hash addresses

3. What is back-end routing?
It is actually a web server. Navigate to a specific html page through the url requested by the user; each time you jump to a different URL, the server is revisited, and then the server returns to the page. The page can also be the server to obtain data, and then combine with the template to return HTML, It can also return the template HTML directly, and then the front-end js will request the data, and use the front-end template and data to combine to generate the desired HTML.

4. The purpose of front-end routing is
mainly used for single-page applications

5. Pros and cons of each

后端路由优点:分担了前端的压力,html和数据的拼接都是由服务器完成。     
        缺点:当项目十分庞大时,加大了服务器端的压力,同时在浏览器端不能输入
              制定的url路径进行指定模块的访问。另外一个就是如果当前网速过慢,
              那将会延迟页面的加载,对用户体验不是很友好。
              

前端路由优点:1.用户体验好,和后台网速没有关系,不需要每次都从服务器全部
               获取,快速展现给用户     
               2.实现了前后端的分离,方便开发。有很多框架都带有路由功能模块。
        缺点: 1.使用浏览器的前进,后退键的时候会重新发送请求,没有合理地利
                 用缓存    
               2.单页面无法记住之前滚动的位置,无法在前进,后退的时候记住
                 滚动的位置

Guess you like

Origin blog.csdn.net/weixin_49092628/article/details/112058954