Skip to content

Instantly share code, notes, and snippets.

@j-thepac
Created June 25, 2023 04:22
Show Gist options
  • Save j-thepac/e766017c8f866087df7bf56a449d5d1c to your computer and use it in GitHub Desktop.
Save j-thepac/e766017c8f866087df7bf56a449d5d1c to your computer and use it in GitHub Desktop.
from fastapi import FastAPI,Request
from pydantic import BaseModel
import uvicorn
from smslottery import validate_bet
from fastapi.middleware.cors import CORSMiddleware
origins = ["*"]
class Data(BaseModel):
game:str
text:str
app= FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
@app.post("/")
def fn(d:Data):return d.game+g.text
if(__name__=="__main__"):uvicorn.run("server:app",host="localhost",port=4321)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment