project
A Test Project with Laravel API to be use with React JS CMS Web Application and React Native Mobile Apps.
I created a normal Laravel project and make following API routes with Auth protection using Json Web Token (JWT) saving it on session using function in Test 1 UI (React JS front end). Also, I assumed Laravel User as Teacher who uses the UI Application and Auth Guard Student and formatted the APIs.
API Routes:
1. Teacher login to get JWT token if valid user
POST: http://localhost:8000/api/login
2. Student Login to get JWT token if valid user
POST: http://localhost:8000/api/login/student
3. Create an Assignment (Protected: Access Only to Teacher)
POST: http://localhost:8000/api/assignment
4. View All Assignments
GET: http://localhost:8000/api/assignment
5. View Single Assignment
GET: http://localhost:8000/api/assignment/{id}
6. Create Submission (Protected: Access Only to Student)
POST: http://localhost:8000/api/submission
7. View All Submission (Protected: Access Only to Teacher)
GET: http://localhost:8000/api/submission
8. Delete Submission (Protected: Access Only to Student who made submission)
DEL: http://localhost:8000/api/submission/{id}
9. View Student detail (Protected: Access Only to Teacher)
GET: http://localhost:8000/api/student/{id}
In React JS front end I used regular basic React useState, useEffect to maintain the state and fetch on load data from above APIs. I also implemented the uses of secondary library like Formik and Yup for data validations in the login and create assignment forms. I have used axios for dealing with HTTP Requests and basic bootstrap for front end UI in the project.
GitHub Repo:
https://github.com/saazan14/project_api https://github.com/saazan14/project_ui
API Documentation
https://documenter.getpostman.com/view/27168079/2s93zH1yUL