Cannot define new DELETE /users/me
endpoint
#444
-
In my API, I would like to support a user being able to delete their own account (like most sites that have a delete button within their account page). To do this, I figured I would add a new route: @app.delete("/users/me", status_code=204)
async def delete_me(user: UserDB = Depends(fastapi_users.get_current_user)):
await user_db.delete(user)
return None However, this doesn't work because Any idea if there's a way to override a FastAPI route or would it be worth having an option to customize which routes get applied? Overall, it's not a big deal though because it just means my API's naming is a bit more clunky with something like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
You're right, the superuser route I've played around a bit and found out that if we suffix the superuser routes with the convertor Sounds a quick, easy and relevant fix. I'll implement this quickly! |
Beta Was this translation helpful? Give feedback.
You're right, the superuser route
DELETE /{id}
is taking precedence there.I've played around a bit and found out that if we suffix the superuser routes with the convertor
:uuid
(a Starlette feature not documented in FastAPI), it lets pass/me
route that would be defined after.Sounds a quick, easy and relevant fix. I'll implement this quickly!