Skip to content

Latest commit

 

History

History

CyberNX

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Task Assigment

Create an API with Login and Register functionality.

  • You must ask additional personal information while registration. Additional fields must contain at least following: First Name, Last Name, Phone Number and profile photo.
  • All fields must have back-end validation.
  • Front-end is not a requirement for this app., you can use postman to test your API.

Solution

Download the Assignment Folder
  • First of all you need to download the folder using Download link <== CyberNX Assignment Folder

  • This will take you to a Web page where Your download will Get started Automatically image

  • Save Zip file to your Required folder and Then Extract it as Well.

  • After Extracting you will see A Readme.md File and a Sub directory with project Name

  • Open this project folder (Dj_Auth).

Setting Up the server
  • Open it in a Terminal or vs code and open terminal there image

  • Run the following command python manage.py runserver

image

  • And open the following link in your browser http://127.0.0.1:8000/

Task Completed - Created 2 APis

1. Login

image

Here you can login and logout

  • to Login image

Construct a json post with data as

{
    "username":"kabir",
    "password":"pass"
}
  • Response image

  • to Logout Send an Empty Request

  • Response image

2. Register

  • ON GET Request image

Shows all the registered accounts so far !

  • On POST Request image

Construct a json post with data as

{
    "username":"kabir",
    "password":"pass",
    "first name":"kabir",
    "last name":"Sharma",
    "phone number":"8528425675",
    "profile pic": ""
}
  • Response image

A Default user with default profile pic is created (Bcoz No profile was mentioned) image

Here you need to upload profile pic using Pillow in Django so If you can send pic in request, It will put it as profile pic!