Code Monkey home page Code Monkey logo

college-marketplace-fastapi's Introduction

College Marketplace Backend API using FastAPI

Screenshot:

API Routes

This API provides 4 routes:

1. Listing Route

This route handles the retrieval, creation, deletion, and updating of listings.

2. Users Route

This route is used for user creation, searching users by ID, searching listings by user ID, and retrieving orders for a logged-in user.

3. Auth Route

This route manages user login and authentication.

4. Orders Route

This route is used to create new orders for an existing listing and change the status of a pending order.

Setup

  1. Clone this repository:

    git clone https://github.com/Romansth/College-Marketplace-FASTAPI.git
    cd College-Marketplace-FASTAPI
  2. Create a virtual environment:

    python3.9 -m venv <virtual_env_path>
  3. Activate the virtual environment:

    source  <virtual_env_path>/bin/activate

Running Locally

  1. Install dependencies:

    pip install -r requirements.txt  
  2. Start the API:

    uvicorn app.main:app --reload
  3. Access the API documentation at: http://127.0.0.1:8000/docs

  4. Set up a PostgreSQL database and create a .env file in the root folder with the following content:

    DATABASE_HOSTNAME=localhost DATABASE_PORT=5432 DATABASE_PASSWORD=your_database_password DATABASE_NAME=your_database_name DATABASE_USERNAME=your_database_username SECRET_KEY=09d25e094faa2556c818166b7a99f6f0f4c3b88e8d3e7 ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=60

    Note: Replace the placeholder values with your actual database configuration.

  5. Use a secure, unique SECRET_KEY from the FastAPI documentation.

  6. To run tests with pytest:

    pytest

Running Locally with Docker

  1. Prerequisites:
  1. Build the Stack
docker-compose -f local.yml build
  1. Run the Stack
docker-compose -f docker-compose-dev.yaml up

You can set environment variables manually in docker-compose-dev.yaml or point .env variables to the docker-compose-dev.yaml file.

To run in detached (background) mode:

docker-compose up -d
  1. Access the API documentation at: http://127.0.0.1:80/docs

License

This project is licensed under the MIT License.

college-marketplace-fastapi's People

Contributors

romansth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.