-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathFastAPI.py
executable file
·76 lines (62 loc) · 1.85 KB
/
FastAPI.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python3
# coding=utf-8
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2022-06-28 15:13:25 +0100 (Tue, 28 Jun 2022)
#
# https://github.com/HariSekhon/templates
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
# ============================================================================ #
# F a s t A P I S t a r t e r A p p
# ============================================================================ #
# https://fastapi.tiangolo.com/
#
# https://github.com/tiangolo/fastapi
# Usage:
#
# pip install fastapi "uvicorn[standard]"
#
# uvicorn <filename>:<fastapi_app>
#
# run: uvicorn api:app --reload
#
# http://127.0.0.1:8000
#
# http://127.0.0.1:8000/docs # autogenerated API docs
#
# http://127.0.0.1:8000/redoc # alternative API docs
# XXX: DO NOT NAME THIS FILE 'fastapi.py' as it'll break the fastapi import
# Don't even do this with differing capitalization as it may break on case insensitive filesystems that are non-case preserving
# It is named FastAPI.py only for convenience and ease of finding in this repo here
"""
FastAPI Starter App
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
#import logging
#import os
#import re
#import sys
#import time
#import traceback
# from typing import Union
from fastapi import FastAPI
__author__ = 'Hari Sekhon'
__version__ = '0.1'
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
# @app.get("/items/{item_id}")
# def read_item(item_id: int, q: Union[str, None] = None):
# return {"item_id": item_id, "q": q}