This is Adonis CRUD api project for student and university sides, you can store student data when there are university in database
This project require a localhost server to make a migration and you have to create and set .env by yourself
adonis serve --dev
medthod: GET api/:version/student
"status": 200,
"data": [
{
"id": 1,
"first_name": "John",
"last_name": "Doe",
"created_at": null,
"updated_at": null
}
]
medthod: GET api/:version/student/:id
"status": 200,
"data": [
{
"id": 1,
"first_name": "John",
"last_name": "Doe",
"created_at": null,
"updated_at": null,
"universities": [
{
"id": 1,
"short_name": "HW",
"full_name": "Hogwarts",
"created_at": null,
"updated_at": null,
"pivot": {
"university_id": 1,
"student_id": 1
}
}
]
}
]
medthod: POST api/:version/student
headers: {'Content-Type': 'application/json'},
body: JSON.stringsify({
first_name: "John",
last_name: "Doe",
university_name: "Hogwarts"
})
"status": 200,
"data": {
"student": [
{
"first_name": "John",
"last_name": "Doe",
"created_at": "NULL",
"updated_at": "NULL",
"id": 1
}
],
"universty_name": "Hogwarts",
"education_degree": "master"
},
"message": "Success"
"status": 200,
"message": "University not found"
"status": 200,
"message": "Create degree for university"
medthod: PUT api/:version/student/:id
headers: {'Content-Type': 'application/json'},
body: JSON.stringsify({
first_name: "Jack",
last_name: "Snow",
})
"status": 200,
"data": {
"first_name": "John",
"last_name": "Doe",
"created_at": "null",
"updated_at": "null",
"id": 1
}
"status": 200,
"data": {
"first_name": "Jack",
"last_name": "Snow",
"created_at": "null",
"updated_at": "null",
"id": 1
}
medthod: DELETE api/:version/student/:id
"status": 200,
"message": "Item ${id} is destroying"
medthod: GET api/:version/university
"status": 200,
"data": [
{
"id": 1,
"short_name": "HW",
"last_name": "Hogwarts",
"created_at": null,
"updated_at": null
}
]
medthod: GET api/:version/university/:id
"status": 200,
"data": [
{
"id": 1,
"short_name": "HW",
"full_name": "Hogwarts",
"created_at": null,
"updated_at": null,
"students": [
{
"id": 1,
"first_name": "John",
"full_name": "Doe",
"created_at": null,
"updated_at": null,
"pivot": {
"university_id": 1,
"student_id": 1
}
}
]
}
]
medthod: POST api/:version/university
headers: {'Content-Type': 'application/json'},
body: JSON.stringsify({
short_name: "HW",
full_name: "Hogwarts",
university_name: "Hogwarts"
})
"status": 200,
"data": {
"short_name": "HW",
"last_name": "Hogwarts",
"created_at": "null",
"updated_at": "null",
"id": 1
}
medthod: PUT api/:version/university/:id
headers: {'Content-Type': 'application/json'},
body: JSON.stringsify({
short_name: "Todai",
full_name: "The University of Tokyo",
})
"status": 200,
"data": {
"short_name": "HW",
"full_name": "Hogwarts",
"created_at": "null",
"updated_at": "null",
"id": 1
}
"status": 200,
"data": {
"short_name": "Todai",
"full_name": "The University of Tokyo",
"created_at": "null",
"updated_at": "null",
"id": 1
}
medthod: DELETE api/:version/university/:id
"status": 200,
"message": "Item ${id} is destroying"