Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fastapi
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kl_internship
fastapi
Commits
99271261
Commit
99271261
authored
Jan 24, 2023
by
rakesh.pv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post exmaple 2
parent
67195b54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
main2.py
+49
-0
No files found.
main2.py
0 → 100644
View file @
99271261
from
fastapi
import
FastAPI
from
pydantic
import
BaseModel
app
=
FastAPI
()
#basemodel
class
detailss
(
BaseModel
):
name
:
str
classs
:
int
age
:
int
@app.post
(
"/create"
)
def
create_student
(
requests
:
detailss
):
return
{
f
"details is crreated with student name {requests.name}"
}
@app.get
(
"/"
)
def
index
():
return
" WELCOM TO MY PAGE"
details
=
{
1
:
{
"name "
:
" a"
,
"classs"
:
2
,
"age"
:
20
},
2
:
{
"name "
:
" b"
,
"classs"
:
1
,
"age"
:
10
}
}
@app.get
(
"/class_details"
)
def
class_details
():
return
details
@app.get
(
"/find/{n}"
)
def
find
(
n
:
int
):
return
details
[
n
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment