feat: Update endpoint signup
This commit is contained in:
parent
b92e35db55
commit
9febf8a338
@ -1,13 +1,20 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
class UserRegistration(BaseModel):
|
||||
username: str
|
||||
password: str
|
||||
email: str
|
||||
class RequestBody(BaseModel):
|
||||
data: str
|
||||
|
||||
@router.post("/signup")
|
||||
async def signup(user: UserRegistration):
|
||||
return {"message": "User registered successfully", "user": user.username}
|
||||
@router.post("/api")
|
||||
async def create_api(body: RequestBody):
|
||||
"""
|
||||
Create a simple API endpoint
|
||||
"""
|
||||
if not body.data:
|
||||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Data is required")
|
||||
|
||||
# Process the data and return a response
|
||||
response_data = {"message": f"Received data: {body.data}"}
|
||||
return response_data
|
Loading…
x
Reference in New Issue
Block a user