-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhello_world.py
42 lines (35 loc) · 942 Bytes
/
hello_world.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'''
@module: API
This is how you create your your API logic
@authors: Leonardo Mauro <leomaurodesenv>
@link: https://github.com/leomaurodesenv/data-science-api-framework GitHub
@license: MIT License
@copyright: 2021 Leonardo Mauro
@access: public
'''
# Main imports
from typing import Dict, Any
from fastapi import APIRouter
# ----------------------------------------------------------------------
# Global variables
RESPONSE = {"status": "ok"}
ROUTER = APIRouter(
prefix="/hello_world",
tags=["hello_world"],
responses={404: {"description": "Not found"}},
)
# ----------------------------------------------------------------------
# Endpoint router
@ROUTER.get("/")
async def health_check():
'''
API health check
'''
return RESPONSE
@ROUTER.post("/")
async def hello_world(_request: Dict[Any, Any] = None):
'''
API main throughput
- request: Request entry
'''
return {'hello': 'world'}