- Open terminal
git clone https://github.com/lamaparbat/HERALD-API-SERVER.git
[ctrl & ctrl+v]cd HERALD-API-SERVER
[ctrl & ctrl+v]npm install
[ctrl & ctrl+v]npm run dev
[ctrl & ctrl+v]
Kudos ππ. Good to go now ππ½ππ½. Test api using postman.
- Login
POST : /api/v4/student/Login
payload: {
uid:"np03cs21@heraldcollege.edu.np"
}
****** -> Response <- *******
onSuccess: {
message: 'Login succesfull !!',
email:"np03cs4s210869@heraldcollege.edu.np",
scope:"student",
accessToken:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd",
refreshToken:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd",
}
onFailure: {
message: 'Failed to login. Please use correct email !!',
token: null,
}
PUT : /api/v4/RegenerateToken
header:{
"Authorization": "refreshToken ${refreshToken}"
}
****** -> Response <- *******
onSuccess: {
message: 'Token regenerated succesfully !!',
accessToken: accessToken,
refreshToken: refreshToken
}
onFailure: {
message:"Refresh token cannot verified."
}
- Login
POST : /api/v4/teacher/Login
payload: {
email:"",
password:""
}
****** -> Response <- *******
onSuccess: {
message:"Login succesfully",
email:"bishalkhadka32@gmail.com",
scope:"teacher",
accessToken:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd",
refreshToken:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd",
}
onFailure: {
message:"Failed to login",
token:null
}
- Signup
POST: /api/v4/teacher/Signup
payload: {
email:"",
password:""
}
****** -> Response <- *******
onSuccess: {
message:"Account created succesfully",
token:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd"
}
onFailure: {
message:"Failed to create account !1",
token:null
}
- Login
POST : /api/v4/admin/Login
payload: {
email:"",
password:""
}
****** -> Response <- *******
onSuccess: {
message:"Login succesfully",
email:"nirmal55@gmail.com",
scope:"admin",
accessToken:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd",
refreshToken:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd",
}
onFailure: {
message:"Failed to login",
token:null
}
- Signup
POST: /api/v4/admin/Signup
payload: {
email:"",
password:""
}
****** -> Response <- *******
onSuccess: {
message:"Account created succesfully",
token:"s23241sfsdf.ad34fdsfdsdf.34sfgsfsfsfsd"
}
onFailure: {
message:"Failed to create account !!",
token:null
}
- Create routine
POST: /api/v4/admin/postRoutineData
//header.authorization.bearer
token: ""
// send data
payload: {
courseType: string,
moduleName: string,
teacherName: string,
classType: string,
group: string,
roomName: string,
blockName: string,
day: string,
startTime: string,
endTime: string,
status: string
}
****** -> Response <- *******
onSuccess: {
message:"Routine posted successfully.",
}
onFailure: {
message:"Failed to post the routine !!",
}
- Read/Fetched routine data
GET: /api/v4/routines
//params || query
group= 8 [For STUDENT = required , For ADMIN & TEACHER = Optional ].
id = string [Optional]
//header.authorization.bearer
token: ""
****** -> Response <- *******
onSuccess: {
[
{
courseType: string,
moduleName: string,
teacherName: string,
classType: string,
group: string,
roomName: string,
blockName: string,
day: string,
startTime: string,
endTime: string,
status: string
},
...
]
}
onFailure: {
message: "500 INTERNAL SERVER ERROR !!"
}
GET: api/v4/routines/ongoing?group=:groupCode
params: group
response: [objects]
- Update routine data
PUT: /api/v4/admin/updateRoutineData
!! the token must be attached to the header => header.authorization.bearer
token: ""
payload: {
courseType: string,
moduleName: string,
teacherName: string,
classType: string,
group: string,
roomName: string,
blockName: string,
day: string,
startTime: string,
endTime: string,
status: string
}
****** -> Response <- *******
onSuccess: {
message:"Routine successfully updated.",
}
onFailure: {
message: "Internal Server Error !!"
}
- Delete routine data
DELETE: /api/v4/admin/deleteRoutineData?routineID=number
query: {
routineID:""
}
****** -> Response <- *******
onSuccess: {
message:"Routine successfully deleted.",
}
onFailure: {
message: "Internal Server Error !!"
}
### User feedback CRUD (Recently updated !!)
1. Post feeback
```perl
POST: /api/v4/feedback/postFeedback
//header.authorization.bearer
token: ""
payload = {
reportType:String,
description:String,
file:Object
}
- Fetch feedbacks
GET: /api/v4/feedback/getFeedback
//header.authorization.bearer
token: ""
response = "data": [
{
"_id": "62a2de564582e52de9b8f891",
"reportType": "suggestion",
"description": "i am testing mode",
"file": "1654840918671-next.png",
"__v": 0
},
]
- Delete feedbacks
DELETE: /api/v4/feedback/deleteFeedback?feedbackId=
// query
feedbackId = String
//header.authorization.bearer
token: String
- Get notificaitons
GET: /api/v4/getNotifications
// query
group: String
// headers
accessToken: Bear token
// success response
StatusCode: 200 (OK)
[
{
_id: String,
message: String,
group: String,
createdOn: String
}
]
// failure response
StatusCode: 400
- Upload student excell sheet (Please donot upload file other than xlsx format)
POST: /api/v4/uploadStudentList
//header.authorization.bearer
token: ""
//payload
file:[objects]. [NOTE: File extension must be xlsx and table field ordering must be like S.N. , Student ID, ....]
//success response
Status Code: 200. ok
message = Data extracted and import to DB successfully.
//error client side failure response
Status Code: 400
message = Please donot upload file other than xlsx
//error server side failure response
Status Code: 500
message = SERVER ERROR
- Concurrency -> PM2 (cpu core utilization technique + Load balancing)
- Social media api sync (Public api + Scrapping [Alternatives])
- Auto scaling with Cloud Services
- CRON [Scheduler] !PRIORITY
- Aggregation Framework for data mapping
- Devops + AWS Serivice integration [Premium]
- Log tracing & Management [Premium]
- Routine Management System. [incl. Dynamic routine search ]
- Lost and Found services.
- User feedbacks.
- Role based Authentication.
- Isolated versioning and configs (Into Production & Development)
- System Security [Incl. Password Hashing (SHA256) (Secure Hash Algorithm), Data encapsulation ]
- Redis implementation completed. [TEST]
- Social Media api integration test. [e.g Fetch instragram posts]
- Overal optimization [max time]
Author: Parbat Lama
Happy Learning βοΈ Happy Coding π¨βπ»