Skip to content

Alihaghayegh/FastAPI-simple-user-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

FastAPI Simple User CRUD API

  • This App serves the CRUD API for users written in FastAPI.
  • It simply recieves a post request for adding user and saves it to database.
  • The default config it on PostgreSQL but feel free to uncomment the SQLite config in core/dabase.py.
# SQLALCHEMY_DATABASE_URL = "sqlite:///./users.db"
SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"

engine = create_engine(SQLALCHEMY_DATABASE_URL)

# engine = create_engine(
#     SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
# )
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
  • Create your .env file and put your main config in it.

  • To start the App run the following commands in your terminal:

for installing the dependencies:

$ pip3 install -r requirements.txt

for starting the App:

$ uvicorn main:app --reload

Releases

No releases published

Packages

No packages published

Languages