The source code given is for cross checking the logic and legality of the api code. It cant be locally tested without the Database credentials, which are supposed to be protected in a .env file. If hiring managers require to test the repo locally on their machine, they can contact me by opening an issue.
18.221.133.215:3000 (Elastic IP has been removed because of incurred costs)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjc3ODY3OTYxfQ.6pWUFGFJzWjdITpj4MQZemmp2C8t1qhHTJVBQmQSW6I
This contains the info: { id: 0, name: "admin" }
which can be used to access routes only meant for admin (/admin/slot, /admin/faculty, /admin/student, /admin/course)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IktpcmFucmFhaiIsImlhdCI6MTY3Nzg2ODA0Nn0.v16b2uwIGh5FIBGyfYj9wV3Hin7V5YEy2Bgqnkm6mAc
This contains the info: { id: 1, name: "Kiranraaj" }
which can be used by access routes meant for the particular student. This way a student cant access other students info as they dont know other students Access token. Thanks to Json Web Tokens, They will only be able to get their token
Courses (http://18.221.133.215:3000/courses)
Slots (http://18.221.133.215:3000/slots)
Faculties (http://18.221.133.215:3000/faculties)
This is used to create faculties
curl --request POST \
--url http://18.221.133.215:3000/admin/faculty \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjc3ODY3OTYxfQ.6pWUFGFJzWjdITpj4MQZemmp2C8t1qhHTJVBQmQSW6I' \
--header 'Content-Type: application/json' \
--data '{
"id": "4",
"name": "Prof. Nachiyappan"
}'
- 401 Forbidden Req (Make sure you are an admin or using admin token)
- 500 Server error (Server Might be down or Faculty already exists)
- 201 Ok Status code e.g {"success":true,"data":{"id":"4","name":"Prof. Nachiyappan"}
This is used to create courses
curl --request POST \
--url http://18.221.133.215:3000/admin/course \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjc3ODY3OTYxfQ.6pWUFGFJzWjdITpj4MQZemmp2C8t1qhHTJVBQmQSW6I' \
--header 'Content-Type: application/json' \
--data '{
"id": "2",
"name": "CSE3502",
"slot_ids": [
"G1"
],
"faculty_ids": [
"4"
],
"course_type": "THEORY"
}'
- 401 Forbidden Req (Make sure you are an admin or using admin token)
- 405 Invalid Slot (Make sure Slot already exists)
- 500 Server error (Server Might be down)
- 201 Ok Status code e.g {"success":true,"data":{"id":"2","name":"CSE3502","faculties":[{"id":"4","name":"Prof. Nachiyappan"}],"allowed_slots":[]}}
This is used to create students
curl --request POST \
--url http://18.221.133.215:3000/admin/student \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjc3ODY3OTYxfQ.6pWUFGFJzWjdITpj4MQZemmp2C8t1qhHTJVBQmQSW6I' \
--header 'Content-Type: application/json' \
--data '{"id": "2", "name": "test"}'
- 401 Forbidden Req (Make sure you are an admin or using admin token)
- 500 Server error (Server Might be down)
- 201 Ok Status code e.g {"success":true,"data":{"id":"2","name":"test"}}
This is used to create slots
curl --request POST \
--url http://18.221.133.215:3000/admin/slot \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjc3ODY3OTYxfQ.6pWUFGFJzWjdITpj4MQZemmp2C8t1qhHTJVBQmQSW6I' \
--header 'Content-Type: application/json' \
--data '{
"id": "C1",
"timings": [
{
"day": "WED",
"start": "2019-10-24T14:15:22Z",
"end": "2019-10-24T14:15:22Z"
}
]
}'
- 401 Forbidden Req (Make sure you are an admin or using admin token)
- 500 Server error (Server Might be down or Slot already exists)
- 201 Ok Status code e.g {"success":true,"data":{"id":"2","name":"test"}}
This is used to access faculty information
curl --request GET \
--url http://18.221.133.215:3000/faculty/1 \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IktpcmFucmFhaiIsImlhdCI6MTY3Nzg2ODA0Nn0.v16b2uwIGh5FIBGyfYj9wV3Hin7V5YEy2Bgqnkm6mAc' \
--header 'Content-Type: application/json'
- 401 Forbidden Req (Make sure you are an admin or using admin token)
- 500 Server error (Server Might be down)
- 201 Ok Status code e.g {"success":true,"data":[{"id":"1","name":"Nayeem Khan Sir"}]
This is used to access faculty information
curl --request GET \
--url http://18.221.133.215:3000/course/1 \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IktpcmFucmFhaiIsImlhdCI6MTY3Nzg2ODA0Nn0.v16b2uwIGh5FIBGyfYj9wV3Hin7V5YEy2Bgqnkm6mAc' \
--header 'Content-Type: application/json'
- 401 Forbidden Req (Make sure you are an admin or using admin token)
- 500 Server error (Server Might be down)
- 201 Ok Status code e.g {"success":true,"data":{"id":"1","name":"CSE","slot_ids":["A1"],"faculty_ids":["1"],"course_type":"THEORY"}}
Student should be able to register
curl --request POST \
--url http://18.221.133.215:3000/register \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IktpcmFucmFhaiIsImlhdCI6MTY3Nzg2ODA0Nn0.v16b2uwIGh5FIBGyfYj9wV3Hin7V5YEy2Bgqnkm6mAc' \
--header 'Content-Type: application/json' \
--data '{
"course_id": "2",
"faculty_id": "4",
"slot_ids": [
"G1"
]
}'
- 401 Forbidden Req (Make sure you using valid token)
- 405 Slots clash
- 500 Server error (Server Might be down)
- 201 Ok Status code
Student should be able to see (only) his timetable
curl --request GET \
--url http://18.221.133.215:3000/timetable \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6IktpcmFucmFhaiIsImlhdCI6MTY3Nzg2ODA0Nn0.v16b2uwIGh5FIBGyfYj9wV3Hin7V5YEy2Bgqnkm6mAc' \
--header 'Content-Type: application/json'
- 401 Forbidden Req (Make sure you are using valid token)
- 500 Server error (Server Might be down)
- 201 Ok Status code
- Use the admin auth token to create a particular slot
- Register a faculty as admin
- Create a course with generated slot and admin. (If error occurs, check that you didnt create an entry with duplicate primary key)
- As a public user, you can view faculty information and course information
- As a student, use the given student auth token (The given token is of Student id. 1), Register for avaialable courses