基於網頁模板的前後端整合框架 以Vue.js與PHP為例

Web Template-based Front-end and Back-end Integration Framework - A Case Study of Integrating Vue.js and PHP

檔案

日期

2020

類型

語言

中文

摘要

在網頁開發的流程中,參與開發的工程人員依據職責與使用的技術,大略可區分為「前端工程師」與「後端工程師」兩種,但兩者不論是撰寫的程式語言、程式執行的環境、所使用的工具、需要具備的技能都是大相徑庭,是以前後端要如何整合,一直以來都是工程上的重要議題。

而根據使用技術以及出現時間的不同,前後端整合的方式可以從早期到現在依序分為「前後端混合」、「前後端分離 - Client Side Rendering (CSR)」與「前後端分離 - Server Side Rendering (SSR)」三種。由於早期的前後端混合的整合方法,有著前後端工程師職責不清、業務紛雜、溝通成本升高等問題,為了解決這些問題,因此近年出現了前後端分離的整合方法,並且又根據頁面渲染(Rendering)地方的不同,可以區分為CSR,以及SSR,雖然前者發展較早,但因為該方法有著首頁載入較慢、因爬蟲無法取得頁面內容,導致搜尋排名結果較差等等的問題,為了解決這些問題,後續發展出了SSR的整合方法,但SSR卻也有著增加伺服器負荷、單一服務可用資源減少、大幅增加開發、測試、維運、管理上的複雜度等等問題。

為了解決上述「前後端分離-SSR」開發方式,因為將原本單一Server服務拆分成Rendering Server與API Server,進而衍伸出的相關問題,本研究提出一個基於網頁模板的前後端整合框架,並實作一系統,以前端主流框架Vue.js與高市占率後端語言PHP為例,將前端框架的網頁模板自動轉換成後端的網頁模板,並產生說明文件,後端工程師只需根據說明文件傳入資料給對應之模板,即可在不需了解前端網頁模板的語法與內容的情況下,完成前後端整合。透過該方式,就能在保持前後端分離開發之餘,將原本「前後端分離-SSR」所需的Rendering Server之功能弱化並去除,進而提高可維護性、降低網頁開發與維護的複雜度。
According to the fundamentals in the development processes, web engineers can be roughly classified into both front-end and back-end engineers. In essence, we could easily find that the required skills, responsibilities and development tools (including the programming language, execution environment, etc.) of the former ones are totally different from the latter ones. In short, front-end is all about the visual aspects of the website that a user can see and experience. On the contrary, everything that happens in the background can be attributed to the back-end web development. Thus, how to effectively integrate the resources of both front-end and back-end have always been important issues of a website development.

According to the used technologies and the historical development, common development methods to integrate both the front-end and back-end resources can be divided into 3 different types. First of all, early web engineers often took the hybrid approach, mixing the front-end and back-end resources. Unfortunately, we could often find that there existed some critical problems, such as unclear responsibilities, complex job content, and high communication costs, between front-end and back-end engineers. Next, an innovative class of development method were proposed to address the above-mentioned issues by separating both the tasks and resources of the front-end and the back-end. Moreover, due to the different rendering approaches applied, these newly proposed class of methods can be further subdivided into Client-Side Rendering (CSR) and Server-Side Rendering (SSR). However, according to experts, CSR had potential problems such as slow page loading, poor search ranking results (because web crawler cannot obtain the correct page content). Therefore, SSR was further proposed to address the issues of CSR. Nonetheless, SSR also had caused some other potential problems such as increasing server load, reducing the available resources for a single service, greatly increasing the complexity of development, testing, maintenance, management, and so on.

In this thesis, we proposed a novel framework, called WTFBIF (Web Template-based Front-end and Back-end Integration Framework) to address the above-mentioned problems of SSR, and implemented an experimental prototype system to improve the development process of websites consisting of Vue.js (front-end) and PHP (back-end). This prototype system can help convert the web template pages, from front-end framework’s web templates to their corresponding back-end ones, and generate the required integration documents automatically. Next, the back-end engineers only need to follow the integration documents, and feed the required (correct) data onto the corresponding back-end web templates, and the web pages can be rendered correctly from back-end web templates. As the rendered web pages returned to the client side, the front-end framework will validate the correctness of rendered web pages, and handle the client side’s interactions with their users. In this way, we can leverage SSR and keep separating front-end and back-end tasks and resources during web development processes and address the above-mentioned problems of SSR, improving the maintainability and reducing the complexity of web development and maintenance.
顯示完整詮釋資料 統計資料

引用此條目

林罡北 (2020). 基於網頁模板的前後端整合框架 以Vue.js與PHP為例. https://thesis.lib.nycu.edu.tw/handle/20.500.14371/76276

BibTeX RIS

引用文字依 APA 第 7 版格式自動產生,使用前請再核對。

分享

永久網址:https://thesis.lib.nycu.edu.tw/handle/20.500.14371/76276