ibs/echo_server.py
HeshamTB 2c17903012
init: server workds with tls, needs database models
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-03-03 14:42:02 +03:00

26 lines
521 B
Python
Executable File

#/bin/python
import uvicorn
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class EchoType(BaseModel):
val: str
@app.post("/echo")
def get_echo(echo: EchoType):
return echo
if __name__ == '__main__':
#uvicorn server:app --port 8000 --ssl-certfile server.crt --ssl-keyfile server.key
uvicorn.run(
'echo_server:app', port=8000, host='localhost',
reload=False,
ssl_keyfile='server.key',
ssl_certfile='server.crt')