somya-kr / url-shortner-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Structure

The project is structured as follows, ensuring modular and organized management of various functionalities:

project_root
│
├── src
│   ├── routers
│   │   ├── hello.py
│   │   ├── auth.py
│   │   ├── url-short.py
│   │   └── team.py
│   ├── config.py
│   ├── db.py
│   ├── main.py
│   ├── __init__.py
│   └── schemas.py
├── .env
├── .env.example
├── .gitignore
├── README.md
└── requirements.txt


Setup and Installation

Setup

    Install dependencies:
    pip install -r requirements.txt

  1. Setup environment variables:
    • Copy the .env.example to a new file called .env.
      cp .env.example .env
    • Open the .env file and populate it with the necessary values for each variable:
      • JWT_KEY: Enter a secure key for encoding and decoding JSON Web Tokens.
      • CORS_ORIGINS: Define the allowed origins for Cross-Origin Resource Sharing. Use * for allowing all origins in a development environment.
      • DATABASE_URL: Input the connection URI for your MongoDB Instance

  2. Run the application:
    uvicorn src.main:app --reload

    This will start the FastAPI application with hot reloading enabled.



Usage

  • User SignUp: Endpoint: POST /signup

    Payload:

    {
      "name": "John Doe",
      "email": "johndoe@example.com",
      "password": "your_password"
    }
  • User Login: Endpoint: POST /login

    Payload:

    {
      "email": "johndoe@example.com",
      "password": "your_password"
    }

    Response:

    {
      "status": "success",
      "token" : "jwt_token"
    }

About


Languages

Language:Python 96.2%Language:Dockerfile 3.8%