Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
eve - restful api for human
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
begood
January 24, 2018
Programming
0
72
eve - restful api for human
this is my slide for presenting in python meeting in PYMI and VCCLOUD
begood
January 24, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
240
CSC307 Lecture 06
javiergs
PRO
0
690
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
200
CSC307 Lecture 04
javiergs
PRO
0
660
CSC307 Lecture 05
javiergs
PRO
0
500
AI巻き込み型コードレビューのススメ
nealle
2
300
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
730
高速開発のためのコード整理術
sutetotanuki
1
400
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
93
Odyssey Design
rkendrick25
PRO
1
500
The Curious Case for Waylosing
cassininazir
0
240
Information Architects: The Missing Link in Design Systems
soysaucechin
0
780
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
78
KATA
mclloyd
PRO
34
15k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
Rails Girls Zürich Keynote
gr2m
96
14k
Transcript
eve RESTful API for humans Quangvn - VCCLOUD
Eve được phát triển bởi
Mục lục: • Phần 1. Đôi điều về eve •
Phần 2. Tính năng • Phần 3. Ưu điểm, nhược điểm
Phần 1. Đôi điều về eve Đơn giản cùng với
setting.py mặc định ở cùng thư mục DOMAIN={“speakers”: {}} from eve import Eve app = Eve() if __name__ == '__main__': app.run()
Run simple $: python2 run.py * Running on http://127.0.0.1:5000/ (Press
CTRL+C to quit)
Call to api $: http GET :5000/blogs
{ "_items": [ ], "_links": { "parent": { "href": "/",
"title": "home" }, "self": { "href": "blogs", "title": "blogs" } }, "_meta": { "max_results": 25, "page": 1, "total": 0 } }
{ "_items": [ ], "_links": { "parent": { "href": "/",
"title": "home" }, "self": { "href": "blogs", "title": "blogs" } }, "_meta": { "max_results": 25, "page": 1, "total": 0 } } Những object trả về
{ "_items": [ ], "_links": { "parent": { "href": "/",
"title": "home" }, "self": { "href": "blogs", "title": "blogs" } }, "_meta": { "max_results": 25, "page": 1, "total": 0 } } Phần HATEOAS
{ "_items": [ ], "_links": { "parent": { "href": "/",
"title": "home" }, "self": { "href": "blogs", "title": "blogs" } }, "_meta": { "max_results": 25, "page": 1, "total": 0 } } Phần phân trang
Chỉnh sửa setting.py DOMAIN={“speakers”: {}} # mongo connection MONGO_HOST =
'localhost' MONGO_PORT = 27017 MONGO_USERNAME = 'eve_admin' MONGO_PASSWORD = 'eve_admin' MONGO_DBNAME = 'eve_demo' # /blogs RESOURCE_METHODS = ['GET', 'POST'] # /blogs/<id> ITEM_METHODS = ['GET', 'PATCH']
Chỉnh sửa schema blogs = { 'item_title': 'blog', 'additional_lookup': {
'url': 'regex("[\w]+")', 'field': 'name' }, 'schema': { 'name': { 'type': 'string', 'minlength': 1, }, 'content': { 'type': 'string', 'minlength': 1, } } }
Phần 2: Tính năng của eve Mongo Filter: ?where={“lastname”: “pymi”}
Phần 2: Tính năng của eve Python Filter: ?where=lastname==”pymi”
Phần 2: Tính năng của eve Sorting: ?sort=-_created (Giảm dần
theo ngày tạo)
Phần 2: Tính năng của eve Pagination: ?max_results=20&page=2
Phần 2: Tính năng của eve Projection: ?projection={“lastname”: 1} (Chỉ
trả về trường lastname)
Phần 2: Tính năng của eve Embedded: ?embedded={“blogs”: 1} (Trả
dữ liệu kèm theo blog)
Phần 3: Ưu điểm, nhược điểm Ưu điểm: • Dễ
sử dụng • Dễ triển khai • Hỗ trợ nhiều tính năng cần thiết để làm ra API • Có nhiều extension
Phần 3: Ưu điểm, nhược điểm Nhược điểm: • Schema
chưa có phần đổi tên trường • Chỉ dành cho API
Q & A
Lời cám ơn!