Skip to content

Commit 74dc49f

Browse files
committed
first commit
0 parents  commit 74dc49f

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vercel
2+
venv
3+
.idea
4+
__pycache__

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fhebertcisco%2Fdeploy-python-fastapi-in-vercel%2Ftree%2Fmain%2Fpython%2FFastApi&demo-title=FastApi%20%2B%20Vercel&demo-description=Use%20FastApi%202%20on%20Vercel%20with%20Serverless%20Functions%20using%20the%20Python%20Runtime.&demo-url=https%3A%2F%2FFastApi-python-template.vercel.app%2F&demo-image=https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png)
2+
3+
# FastApi + Vercel
4+
5+
This example shows how to use FastApi 0.88.0 on Vercel with Serverless Functions using the [Python Runtime](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/python).
6+
7+
## Demo
8+
9+
https://deploy-python-fastapi-in-vercel.vercel.app/
10+
11+
## How it Works
12+
13+
This example uses the Web Server Gateway Interface (WSGI) with Flask to enable handling requests on Vercel with Serverless Functions.
14+
15+
## Running Locally
16+
17+
```bash
18+
npm i -g vercel
19+
vercel dev
20+
```
21+
22+
Your Flask application is now available at `http://localhost:3000`.
23+
24+
## One-Click Deploy
25+
26+
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
27+
28+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fhebertcisco%2Fdeploy-python-fastapi-in-vercel%2Ftree%2Fmain%2Fpython%2FFastApi&demo-title=FastApi%20%2B%20Vercel&demo-description=Use%20FastApi%202%20on%20Vercel%20with%20Serverless%20Functions%20using%20the%20Python%20Runtime.&demo-url=https%3A%2F%2FFastApi-python-template.vercel.app%2F&demo-image=https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png)

api/index.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from fastapi import FastAPI
2+
3+
app = FastAPI()
4+
5+
@app.get("/")
6+
async def root():
7+
return {"message": "Hello World"}
8+
9+
10+
@app.get("/hello/{name}")
11+
async def say_hello(name: str):
12+
return {"message": f"Hello {name}"}

api/test_index.http

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Test your FastAPI endpoints
2+
3+
GET http://127.0.0.1:8000/
4+
Accept: application/json
5+
6+
###
7+
8+
GET http://127.0.0.1:8000/hello/User
9+
Accept: application/json
10+
11+
###

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fastapi==0.88.0

0 commit comments

Comments
 (0)