Creates a new student object using information from the request body, along with empty arrays for enrolled classes and transaction history.
Returns the newly created student object
URL Params:
- None
Data Params:
{
"firstName": "First Name",
"lastName": "Last Name",
"email": "Email Address",
"uid": "Auto-Generated Unique User ID"
}
Status Code: 201 Created
Response Content:
{
"firstName": "First Name",
"lastName": "Last Name",
"email": "Email Address",
"enrolled_courses": [],
"transaction_history": [],
"uid": "Auto-Generated Unique User ID"
}
Condition: If request body does not have enough information to create a new student
Status Code: 400 Bad Request
Response Message: Error posting new student. Be sure to include a uid, first_name, last_name, and email.
axios.post("/api/students", student)
.then((res) => console.log(res.data))
.catch((err) => console.error(err));