Skip to content

Releases: Yezz123-Archive/ChefAPI

ChefAPI v1.0 🚀

23 Jul 03:26
Compare
Choose a tag to compare

ChefAPI

API using FastAPI and PostgreSQL to create and share or keeping track of awesome food recipes. Our API has also a Crud System Using JWT and Oauth2 to Create a Complete API that Can Be Used with a High-Quality Frontend Project. ⛏

Configured Enviromment

Database

  • Using SQLAlchemy to Connect to our PostgreSQL Database
  • Containerization The Database.
  • Drop your PostgreSQL Configuration at the .env.sample and Don't Forget to change the Name to .env
# example of Configuration for the .env file

POSTGRES_SERVER = localhost
POSTGRES_USER = root
POSTGRES_PASSWORD = password
POSTGRES_DB = ChefAPI

Router

api_router.include_router(login.router, tags=["login"])
api_router.include_router(users.router, prefix="/users", tags=["users"])
api_router.include_router(categories.router, prefix="/recipes", tags=["categories"])
api_router.include_router(recipes.router, prefix="/recipes", tags=["recipes"])

Running the Docker Container

  • We have the Dockerfile created in above section. Now, we will use the Dockerfile to create the image of the FastAPI app and then start the FastAPI app container.
$ docker build
  • list all the docker images and you can also see the image chefapi:latest in the list.
$ docker images
  • run the application at port 5000. The various options used are:
  • -p: publish the container's port to the host port.
  • -d: run the container in the background.
  • -i: run the container in interactive mode.
  • -t: to allocate pseudo-TTY.
  • --name: name of the container
$ docker container run -p 5000:5000 -dit --name ChefAPI chefapi:latest
  • Check the status of the docker container
$ docker container ps