Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
FastAPI+VercelでZennのバッジをお手軽に作る
Search
ganyariya
January 20, 2021
Technology
930
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
FastAPI+VercelでZennのバッジをお手軽に作る
https://rakus.connpass.com/event/198587/
ganyariya
January 20, 2021
More Decks by ganyariya
See All by ganyariya
The Hundred Machine Learning 7.4-7.7
ganariya
0
79
ありがとう競技プログラミングこんにちはDocker
ganariya
0
1.7k
輪講 The hundred ML3.3-3.5
ganariya
0
120
Other Decks in Technology
See All in Technology
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
210
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
350
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
3
850
しろおびから始める!ログ活用の第一歩
shumei_ito
0
920
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
140
USB PDを使ってスマホを労わりたい
raspython3
0
160
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
630
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
170
Running Kotlin + Quarkus with Lambda
nealle
1
470
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.5k
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
130
Datadog の学び方 - あるいは、オブザーバビリティを学ぶとは何か
mananyuki
1
560
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Bash Introduction
62gerente
615
220k
Embracing the Ebb and Flow
colly
88
5.2k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
470
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Site-Speed That Sticks
csswizardry
13
1.6k
GraphQLとの向き合い方2022年版
quramy
50
15k
Unsuck your backbone
ammeep
672
58k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Transcript
FastAPI+VercelでZennのバッジをお⼿軽に作る ganariya FastAPI+Vercel -> Zenn-Badge ganariya
ganariyaの⾃⼰紹介 普段は競技プログラミングをしています そのためバックエンドやAPIは初⼼者です 温かい⽬で⾒守ってやってください 履歴書はGitHubのGanariyaリポジトリにあります ⻑期インターンが終わり、アルバイトを探しています (もしよければぜひ...)(ぜひ...) FastAPI+Vercel -> Zenn-Badge
ganariya
デモ FastAPI+Vercel -> Zenn-Badge ganariya
FastAPI+Vercel -> Zenn-Badge ganariya
FastAPI+Vercel -> Zenn-Badge ganariya
FastAPI+Vercel -> Zenn-Badge ganariya
FastAPIのご紹介 FastAPI+Vercel -> Zenn-Badge ganariya
FastAPI is 何 Python製REST Framework 似たものだと Flask 2018年にできており⾮常にモダンで⾼機能 (Python3.6〜) ASGI
⾮同期処理 GraphQL / WebSocket FastAPIのうれしさ3選について紹介 FastAPI+Vercel -> Zenn-Badge ganariya
その1 型ヒントとバリデーション Type Hintsを積極的に利⽤したフレームワーク username:str と引数で指定すると ⾃動で引数の型をバリデーション 型が正しいかなどの確認ロジックをコードで書かなくてよい 返り値なども型の指定が可能 型
-> IDEの恩恵を受けられる @app.get("/{username}/liked", response_class=HTMLResponse) def get_liked(username: str): user: User = scrape_user(username) badge = make_badge(username, 'Zenn liked', str(user.total_liked_count)) return HTMLResponse(content=badge, status_code=200, media_type='image/svg+xml') FastAPI+Vercel -> Zenn-Badge ganariya
その2 OpenAPIとSwagger-UI FastAPIは⾃動でOpenAPIのフォーマットを吐き出す /docs にアクセスするとSwagger-UIが⾃動で作成される 型をPythonで書くとそのままSwaggerへ! FastAPI+Vercel -> Zenn-Badge ganariya
その3 ドキュメント ドキュメントがとても丁寧 TutorialからAdvancedまで体系的に書かれている ファイル分割 , モジュールのプラクティス なども触れられている FastAPI+Vercel ->
Zenn-Badge ganariya
Vercel FastAPI+Vercel -> Zenn-Badge ganariya
Vercel もともとNow(Zeit社)というサービス そのため、ネットの記事の情報がかなり混在している 似たサービスだと Heroku GitHubから⾃動デプロイ 無料枠が⼤きい 無制限のWebサイト+API Go, Python,
Node.jsなどのサーバーレス ただしデプロイ回数は1⽇あたり制限あり DBが使えない (サーバーレスなので) FastAPI+Vercel -> Zenn-Badge ganariya
FastAPI+Vercel -> Zenn-Badge ganariya
設定ファイル {now, vercel}.json リポジトリのルートに置いてプッシュすると、Vercelが⾃動デプロイ { "version": 2, "builds": [ {
"src": "zenn_badge/app.py", "use": "@now/python" } ], "routes": [ { "src": "/.*", "dest": "zenn_badge/app.py" } ] } FastAPI+Vercel -> Zenn-Badge ganariya
FastAPI + Vercelまとめ FastAPI 型とともに過ごせる ⾮常に⾼機能でモダン Vercel 破格的無料枠 jsonファイルひとつで済む DBは外部を利⽤する
FastAPI + Vercel 開発が楽しい! FastAPI+Vercel -> Zenn-Badge ganariya
ご清聴ありがとうございました! GitHub: ganariya Qiita: ganariya Twitter: ganariya Zenn: ganariya AtCoder:
ganariya2525 FastAPI+Vercel -> Zenn-Badge ganariya