Skip to content

ongyimeng/RESTful-API-with-FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starting up

cd into the project folder and run the following: uvicorn main:app --reload

image

Making use of Swagger UI

access the swagger url with: http://127.0.0.1:8000/docs#/

image

Register a user

Click the Try it out button for the register POST request
Enter your values
Press Execute

image

Successful Response should look like:

image

Login with user

Enter your email in the username field
Enter your password
Press Execute

image

A successful response should give a JWT token that can be used to authenticate subsequent requests

image

Get user own info

I would be using POSTMAN for subsequent requests to make use of the token from login for authentication

image

Select the Authorization tab
Select Bearer Token
Copy paste the token string gotten from login
Press send

image

A successful response should display the user's own information

image

Update user own info

Use the same steps for authorization using the token
For the request body update the fields you want to change
Select JSON
Click Send

image image

The updated fields of user:

image

Delete user

Use the same steps for authorization using the token
Click Send

image

A successful response should look like:

image

Trying to get the info from the same user would now return a 400 Bad Request Response

image image

Ending

I did try to deploy it on render.com but faced technical limitations

image

Nevertheless, thank you for taking the time to read this

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages