Giter Site home page Giter Site logo

yezz123 / frdp Goto Github PK

View Code? Open in Web Editor NEW
62.0 62.0 7.0 107 KB

Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⭐

License: MIT License

Python 95.73% Dockerfile 2.72% Shell 1.55%
asyncio authentication boilerplate docker docker-compose fastapi fastapi-boilerplate jwt jwt-authentication pgadmin postgres postgresql python rest-api sqlalchemy

frdp's Introduction

Hey, Yezz123 here! 👋


I'm Yasser Tahiri, Also known as Yezz123, a Software Engineer, Comedian 🤡 by day, OSS 🛠 by night.


frdp's People

Contributors

dependabot[bot] avatar yezz123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

frdp's Issues

Feature : Add Logout Route 🚀

API URL : http://localhost:5000/api/users/logout

Request Headers

  • Content-Type: application/json
  • authorization: JWT_TOKEN_HERE

Request Body

{
    "token": "JWT_TOKEN_HERE"
}

Response For success

{
    "success": true,
    "msg": "Token revoked"
}

Response for unknown token

{
    "success": false,
    "msg": "User is not logged on"
}

pydantic.error_wrappers.ValidationError: 1 validation error for Msg 🛠

FastAPI will raise a ValidationError for the invalid response and set the field type. This can go wrong if the response model is not a pydantic model (or dataclass). When trying to produce the string representation of the exception, pydantic will try to produce the errors and fail because of the field type passed into the ValidationError not being a BaseModel or DataclassType. I am not sure if we need something like a ResponseValidationError to prevent this issue.

pydantic.error_wrappers.ValidationError: 1 validation error for Msg
response -> msg
  field required (type=value_error.missing)
  • Schema.py
class Msg(BaseModel):
    msg: int
  • Login.py
@router.post("/password-recovery/{email}", response_model=Msg)
def recover_password(email: str, db: Session = Depends(deps.get_db)) -> Any:
    """
    Password Recovery
    """
    user = user1.get_by_email(db, email=email)
    if not user:
        raise HTTPException(
            status_code=404,
            detail="The user with this username does not exist in the system.",
        )
    password_reset_token = generate_password_reset_token(email=email)
    return {"Message": "Password recovery email sent"}

Unable to start the docker containers

Hello Yasser,

Thanks for this python API package, it looks really promising.

I was running through the following commands after cloning

        make pull
	make build
	make start 

Seeing this log on the app frdp container start

psycopg2.OperationalError: could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

The other services are running and here is the SS of services vs .env file setup.

Screen Shot 2021-12-15 at 3 37 11 AM

Screen Shot 2021-12-15 at 3 36 34 AM

Screen Shot 2021-12-15 at 3 36 07 AM

psql shows the DB list in this way, for the lack of understanding on how to get postgres to work properly am merely looking for some insight. Any help is really appreciate-able.

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.