File size: 463 Bytes
ae2ef1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import Body, FastAPI
from typing_extensions import Annotated
from src.models.request import Request

class Routes:
    def __init__(self):
        self.api = FastAPI()

    @api.get('/')
    async def index(self):
        return {'message': 'Hello World!'}

api = FastAPI()



@api.post('/query')
async def query(data: Annotated[Request, Body(embed=True)]):
    handler = Handler(data.query)
    response = handler.tag()
    return {'data': response}