Notes
CRUD
- Create, Read, Update, Delete
- Creating new user
- Showing the table is Read
- You can update or delete users
- fetches every time one of these functions happen, APIs are connected to each function
HTML5
- can do some validations
- Table and form formats
API Request and Response
- endpoint, method, data you want to retrieve
- request goes through API, then calls to Database, gives response
- Put can update data
- Delete can cause dangling posts, can be better to deactivate users
Backend API
- validate input
- Query of Database
- Class Method Call
- RESTful Response
Response Handling
- you can hard code data, call it json so that you don’t need to worry about backend
-
dom: creating document elements
Important code
User
- user_obj =User(name=name, uid=uid) - builds a basic object
- users=User.query.all() - reads all records in database, extract all users in a database
Put
- user=User.query.filter_by(_uid=uid).first()
other lines
@token required()-reads who is logged in, @token required(“admin”)-only lets admin perform things