前後端串接比較


Posted by s103071049 on 2021-06-30

php

  1. 把資料拿出來
  2. 把資料跟 html 結合(ui)
  3. 回傳 html
  4. 瀏覽器 render response

=> server side render,browser 看到甚麼就是甚麼

api (純資料處理)

  1. 把資料拿出來
  2. 變成某種格是 (json)
  3. 回傳
  4. 透過 js 將資料 render 出來

=> browser 看到的 html 是空的,他把 html 載入才執行 js,js 拿完資料再動態將內容新增上去。

比較

雖然兩者都有內容,但一個是瀏覽器一拿到就有資料,一個是瀏覽器拿到是空的要執行完 js 才會有資料。










Related Posts

Sequlize & Express. P3

Sequlize & Express. P3

Gradient text animation

Gradient text animation

學習 Git (8) - Tag 標籤

學習 Git (8) - Tag 標籤


Comments