Demystifying WAF
- http://127.0.0.1/books -> Get all books [Method is GET]
- http://127.0.0.1/books?userId=test@test.com (Get all books which are borrowed by a user)
- http://127.0.0.1/books -> Add/Create a books [Method is POST]
- http://127.0.0.1/books -> UPDATE a book [Method is UPDATE]
- http://127.0.0.1/books -> DELETE a books [Method is DELETE]
- http://127.0.0.1/register -> Register a user [Method is POST]
- http://127.0.0.1/login -> Login a user [Method is POST]
- Books
- BookId(autoIncrement), Author, Title, Publisher, borrowedBy
- Users
- UserId, FName, LName, Password, PhNo, Address
create database library;
use library;
CREATE TABLE users (userid varchar(100) NOT NULL PRIMARY KEY, name varchar(100) NOT NULL, password varchar(100) NOT NULL, phno varchar(100) NOT NULL, address varchar(100) NOT NULL, isadmin boolean NOT NULL);
CREATE TABLE books (bookid int NOT NULL AUTO_INCREMENT PRIMARY KEY, title varchar(100) NOT NULL, author varchar(100) NOT NULL, publisher varchar(100), borrowedby varchar(100) NULL, FOREIGN KEY (borrowedby) REFERENCES users(userid));
show tables;
insert into users values("jas@gmail.com", "test", "test", "test", "test", false);
insert into users values("sum@gmail.com", "test", "test", "test", "test", true);
select * from users;
insert into books values(NULL, "python1", "test", "test", "jas@gmail.com");
insert into books values(NULL, "python1", "test", "test", NULL);
select * from books;