§ 瀏覽學位論文書目資料
  
系統識別號 U0002-0301202315455900
DOI 10.6846/TKU.2023.00011
論文名稱(中文) 遷移Web API之研究-以校園二手市集平台為範例
論文名稱(英文) A study on Migrating Web API - A Case Study of Campus Second-Hand Market Platform
第三語言論文名稱
校院名稱 淡江大學
系所名稱(中文) 資訊管理學系碩士班
系所名稱(英文) Department of Information Management
外國學位學校名稱
外國學位學院名稱
外國學位研究所名稱
學年度 111
學期 1
出版年 112
研究生(中文) 陳昱翔
研究生(英文) Yu-Xiang Chen
學號 609630149
學位類別 碩士
語言別 繁體中文
第二語言別
口試日期 2022-12-17
論文頁數 63頁
口試委員 指導教授 - 廖賀田(htliaw@mail.tku.edu.tw)
口試委員 - 壽大衛(shoutw@gmail.com)
口試委員 - 魏世杰(sekewei@mail.tku.edu.tw)
口試委員 - 廖賀田(htliaw@mail.tku.edu.tw)
關鍵字(中) Web API遷移
RESTful
GraphQL
關鍵字(英) RESTful
GraphQL
Web API Migration
第三語言關鍵字
學科別分類
中文摘要
由於GraphQL的出現,部分開發者想將既有的後端RESTful架構遷移成GraphQL Server,但GraphQL需要花較多時間學習,且開發者可能不清楚該從何下手。
本論文提出了由RESTful遷移至GraphQL的遷移方法,以RESTful架構的校園二手市集平台為範例,並依照本論文所提出的遷移方法將原本現有的RESTful架構之API需求進行遷移。透過分析將該後端架構另外實際遷移成GraphQL Server,在最後實驗比較後端RESTful Server及GraphQL Server兩者的請求API之效能。並分別針對RESTful API及GraphQL API的響應時間、回傳資料量大小及API端點與響應時間之關係圖進行分析。
英文摘要
Due to the appearance of GraphQL, some developers want to migrate the existing back-end RESTful architecture to GraphQL Server, but GraphQL needs to take a lot of time to learn, and developers may not know where to start. This paper proposes a migration method from RESTful to GraphQL, using the campus second-hand market platform with RESTful architecture as a case study, and migrates the API requirements of the original RESTful architecture according to the migration method proposed in this paper. Through the analysis, the back-end architecture is actually migrated to GraphQL Server, In the final experiment will compared the performance of the request API between RESTful Server and GraphQL Server. And analyze the response time of RESTful API and GraphQL API, the size of returned data, and the relationship between API endpoints and response time
第三語言摘要
論文目次
第1章 緒論	1
1.1 研究背景	1
1.2 研究動機與目的	3
第2章 相關技術與研究	4
2.1 Web API	4
2.2 JSON	5
2.3 REST	6
2.4 GraphQL	8
2.4.1 Schema	11
2.4.2 Resolver	12
2.4.3 Query	14
2.4.4 Mutation	15
2.5 Node.js	17
第3章 WEB API遷移方法及分析	18
3.1 RESTful遷移至GraphQL方法	18
3.1.1 分析及整理RESTful架構之既有API端點	18
3.1.2 分析RESTful架構之系統資料庫之資料表關聯	19
3.1.3 整理預計遷移之GraphQL API	19
3.1.4 規劃GraphQL之Schema	19
3.1.5 規劃GraphQL之Resolver	19
3.2 校園二手市集平台	20
3.2.1 系統架構與功能	20
3.2.3 後端RESTful架構	22
3.3 原系統之後端系統分析	24
3.3.1 原系統RESTful架構之API及Model	24
3.3.2 原系統資料庫之關聯	32
3.4 GraphQL API之分析	34
第4章 系統實作及評估比較	40
4.1 系統實作環境	40
4.2 系統架構	41
4.3 GraphQL Server實作	42
4.3.1 GraphQL Server – Schema	43
4.3.2 GraphQL Server – Resolvers	50
4.4 系統評估	54
第5章 結論與未來研究方向	60
5.1 結論	60
5.2 研究限制	61
5.3 未來研究方向	61
參考文獻	62

圖目錄
圖 2 1 Web API請求方式	4
圖 2 2 JSON編碼	5
圖 2 3 XML編碼	5
圖 2 4 GraphQL API請求單一端點	8
圖 2 5 RESTful API多個端點的請求	9
圖 2 6 Schema示意圖	11
圖 2 7 Resolver示意圖[12]	13
圖 2 8 Query示意圖	14
圖 2 9 Schema當中的Mutation示意圖	15
圖 2 10 前端之Mutation請求	16
圖 3 1 系統架構圖	20
圖 3 2 後端程式架構圖	22
圖 3 3 Student Model	24
圖 3 4 Product Model	26
圖 3 5 Category Model	28
圖 3 6 Order Model	29
圖 3 7 Chatroom Model	30
圖 3 8 Announcement Model	31
圖 3 9 資料庫關聯圖	32
圖 4 1 GraphQL Server架構	41
圖 4 2 ApolloServer之設定	42
圖 4 3 Student Schema	43
圖 4 4 Product Schema	44
圖 4 5 Category Schema	45
圖 4 6 Order Schema	46
圖 4 7 Chatroom Schema	48
圖 4 8 Announcement Schema	49
圖 4 9 定義傳入值之型別	50
圖 4 10 Resolvers – Query	51
圖 4 11 Resolvers – Mutation上半部	52
圖 4 12 Resolvers – Mutation下半部	53
圖 4 13 實驗說明	55
圖 4 14 平均響應時間	56
圖 4 15 API回傳之資料量	57
圖 4 16 API端點之請求	58
圖 4 17 API端點之響應時間	59

 
表目錄
表 2 1 HTTP請求方法	7
表 2 2 REST及GraphQL之優點比較[9]	10
表 2 3 Resolver的參數介紹	12
表 2 4 Resolver的回傳值型別	12
表 3 1 系統功能	21
表 3 2 Student之Web API	25
表 3 3 Product之Web API	26
表 3 4 Category之API	28
表 3 5 Order之API	29
表 3 6 Chatroom之API	30
表 3 7 Announcement之API	31
表 3 8 各個資料表之關聯	33
表 3 9 GraphQL之Student API列表	34
表 3 10 GraphQL之Product API列表	35
表 3 11 GraphQL之Category API列表	37
表 3 12 GraphQL之Order API列表	37
表 3 13 GraphQL之Chatroom API列表	38
表 3 14 GraphQL之Announcement API列表	39
表 4 1 硬體與軟體配置	40
表 4 2 測試API之資訊	55
參考文獻
[1].	Fielding, R. T. (2000). Architectural styles and the design of network-based software architectures. University of California, Irvine.
[2].	Wikipedia, GraphQL,
https://zh.wikipedia.org/zh-tw/GraphQL
[3].	Guha, S. (2020). A Comparative Study Between Graph-QL & Restful Services In API Management Of Stateless Architectures. International Journal on Web Service Computing (IJWSC), 11(2).
[4].	Vadlamani, S. L., Emdon, B., Arts, J., & Baysal, O. (2021, June). Can graphql replace rest? a study of their efficiency and viability. In 2021 IEEE/ACM 8th International Workshop on Software Engineering Research and Industrial Practice (SER&IP) (pp. 10-17). IEEE.
[5].	ALPHAcamp, Web API,
https://tw.alphacamp.co/blog/api-introduction-understand-web-api-http-json
[6].	蔡佩純(2014)。Android平台JSON剖析器之效能評估。國立雲林科技大學資訊管理系碩士論文,雲林縣。 
[7].	Gitbook, RESTful,
https://a42033.gitbooks.io/system/content/language/restful.html
[8].	GraphQL DOC, Introduction to GraphQL,
https://graphql.org/learn/
[9].	Amit Phaujdar,GraphQL vs REST:4 Critical Differences,
https://hevodata.com/learn/graphql-vs-rest/#:~:text=GraphQL%20is%20defined%20as%20a%20query%20language%20that,as%20a%20conventional%20standard%20for%20developing%20APIs.%206.
[10].	GraphQL DOC, Schemas and Types,
https://graphql.org/learn/schema/
[11].	Apollo DOC, Resolvers
https://www.apollographql.com/docs/apollo-server/data/resolvers/#resolver-arguments
[12].	Nikolas Burk , Prisma GraphQL,
https://www.prisma.io/blog/graphql-server-basics-demystifying-the-info-argument-in-graphql-resolvers-6f26249f613a
[13].	GraphQL DOC, Queries and Mutations,
https://graphql.org/learn/queries/
[14].	楊哲寬(2019)。以Node.js建構智慧型點單機-結合Dropbox雲端硬碟。南臺科技大學資訊管理系碩士論文,台南市。
[15].	Wikipedia,V8(JavaScript引擎),
https://zh.wikipedia.org/zh-tw/V8_(JavaScript%E5%BC%95%E6%93%8E)
論文全文使用權限
國家圖書館
同意無償授權國家圖書館,書目與全文電子檔於繳交授權書後, 於網際網路立即公開
校內
校內紙本論文立即公開
同意電子論文全文授權於全球公開
校內電子論文立即公開
校外
同意授權予資料庫廠商
校外電子論文立即公開

如有問題,歡迎洽詢!
圖書館數位資訊組 (02)2621-5656 轉 2487 或 來信