You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
660 B

  1. from fastapi import FastAPI
  2. from core.config import settings
  3. from db.session import engine
  4. from db.base import Base
  5. from apis.base import api_router
  6. def include_routes(app): # include all routes from our api/v1/
  7. app.include_router(api_router)
  8. def startup(): # start the project, and create the tables
  9. app = FastAPI(title=settings.PROJECT_NAME, version=settings.PROJECT_VERSION)
  10. Base.metadata.create_all(bind=engine)
  11. include_routes(app)
  12. return app
  13. app = startup()
  14. # Testing stuff
  15. @app.get("/")
  16. def root():
  17. return {"message": "Hello World!"}
  18. @app.get("/user")
  19. def get_users():
  20. return {{"name": "almaz"}, {"name": "madi"}}