Skip to content

Altamash20/My_backend_DigitalLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions to Setup and use APIs: (Author- Mohammad Altamash)

  1. Backend server is running at localhost:8000/

2) Our backend application is named as auth_app
3) Endpoint to register as a user: localhost:8000/auth/register/
4) Endpoint to login for registered users: localhost:8000/auth/login/
5) Endpoint to add a new Book with its details: localhost:8000/auth/books_management/
(but remember you cannot land to ADD BOOK page without getting registered, and then login
6) To retrieve the details of the registered users and saved books from database, we can use interactive Python shell in terminal window:
Command to access Python interactive shell:
python manage.py shell
Now follow below commands:
from django.contrib.auth.models import *

to retrieve all users- User.objects.all()
to get password of user(encrypted with Hashing algorithm)-
User.objects.all()[index of required user].password
you can get other information like First name, Email, Username etc for required user by replacing 'password' in above command


to retrieve all books-
Book.objects.all()
To get detail about different attribute of required books, you can use same command as in case of users
To see how to write tests for APIs here please see tests.py file and viga_script.py file in script directory
Command to check whether tests running successfully-
python manage.py test
Command to run scripts -
python manage.py runscript <script file name>
Note: Do not use .py extension with file in above runscript command


Note: Always check whether the backend server is running before using Endpoints URL
Command to run backend server: python manage.py runserver

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published