- Name : A Farhan Agustiansyah
- University : Sriwijaya University, South Sumatera
- Download this project or clone this repo and save to your local
- Run
composer install
to install all dependencies needed - Open your computer server to run your server, then create new database on your database
- Configure your .env file, go to database section, and configure the database according to the database you are using, the user, and the password you are using as below. If you don't make database yet, so make new database in your server. Then configure in .env file.
DB_CONNECTION=mysql DB_HOST=your_host DB_PORT=your_port DB_DATABASE=your_db_name DB_USERNAME=your_username DB_PASSWORD=your_password
- Run command
php artisan jwt:secret
to generate JWT key for authentication,so your jwt secret is generated in .env fileJWT_SECRET=xxxx
- After that, you can run command
php artisan migrate
to generate all table migrations which is exist in this project - Then, you can run command
php artisan db:seed
to seed your database with default data - Then, you can run command
php artisan serve
to start your laravel server and try the endpoint has been build
Request :
- Method : POST
- Endpoint :
/api/register
- Header :
- Accept: application/json
- Body :
{
"name": "string",
"email": "string, email",
"password": "string",
"password_confirmation": "string"
}
Response :
{
"message": "string"
}
Request :
- Method : POST
- Endpoint :
/api/login
- Header :
- Accept: application/json
- Body :
{
"email": "string, email",
"password": "string",
}
Response :
{
"access_token": "string",
"token_type": "string",
"expires_in": "integer",
}
Request :
- Method : POST
- Endpoint :
/api/logout
- Header :
- Accept: application/json
- Query Param :
- token: "string"
Response :
{
"message": "string"
}
Request :
- Method : POST
- Endpoint :
/api/register
- Header :
- Accept: application/json
- Autohorization: Bearer token
Response :
{
"id": "integer",
"name": "string",
"email": "string",
"email_verified_at": "string",
"created_at": "string",
"updated_at": "string"
}
Request :
- Method : GET
- Endpoint :
/api/mahasiswa
- Header :
- Accept: application/json
- Autohorization: Bearer token
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": [
{
"nama": "string",
"email": "string, email",
"NIM": "string, unique",
"jenis_kelamin": "string",
"semester": "integer",
"angkatan": "year",
"fakultas": [
{
"id": "integer",
"fakultas": "string",
},
],
"prodi": [
{
"id": "integer",
"program_studi": "string",
},
],
"created_at": "string",
"updated_at": "string",
},
...
]
}
Request :
- Method : GET
- Endpoint :
/api/mahasiswa/{nim}
- Header :
- Accept: application/json
- Autohorization: Bearer token
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": [
{
"nama": "string",
"email": "string, email",
"NIM": "string, unique",
"jenis_kelamin": "string",
"semester": "integer",
"angkatan": "year",
"fakultas": [
{
"id": "integer",
"fakultas": "string",
},
],
"prodi": [
{
"id": "integer",
"program_studi": "string",
},
],
"created_at": "string",
"updated_at": "string",
},
]
}
Request :
- Method : POST
- Endpoint :
/api/mahasiswa
- Header :
- Accept: application/json
- Autohorization: Bearer token
- Body :
{
"nama": "string",
"email": "string, email",
"NIM": "string, unique",
"jenis_kelamin": "string",
"semester": "integer",
"angkatan": "year",
}
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": {
"nama": "string",
"email": "string, email",
"NIM": "string, unique",
"jenis_kelamin": "string",
"semester": "integer",
"angkatan": "year",
"fakultas": [
{
"id": "integer",
"fakultas": "string",
},
],
"prodi": [
{
"id": "integer",
"program_studi": "string",
},
],
"created_at": "string",
"updated_at": "string",
},
}
Request :
- Method : POST
- Endpoint :
/api/mahasiswa/{nim}
- Header :
- Accept: application/json
- Autohorization: Bearer token
- Body :
{
"nama": "string",
"email": "string, email",
"NIM": "string, unique",
"jenis_kelamin": "string",
"semester": "integer",
"angkatan": "year",
}
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": {
"nama": "string",
"email": "string, email",
"NIM": "string, unique",
"jenis_kelamin": "string",
"semester": "integer",
"angkatan": "year",
"fakultas": [
{
"id": "integer",
"fakultas": "string",
},
],
"prodi": [
{
"id": "integer",
"program_studi": "string",
},
],
"created_at": "string",
"updated_at": "string",
},
}
Request :
- Method : DELETE
- Endpoint :
/api/mahasiswa/{nim}
- Header :
- Accept: application/json
- Autohorization: Bearer token
- Content-Type: application/json
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": []
}
Request :
- Method : GET
- Endpoint :
/api/prodi
- Header :
- Accept: application/json
- Autohorization: Bearer token
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": [
{
"id": "integer",
"program_studi": "string",
},
...
]
}
Request :
- Method : POST
- Endpoint :
/api/prodi
- Header :
- Accept: application/json
- Autohorization: Bearer token
- Body :
{
"program_studi": "string",
"fakultas_id": "integer",
}
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": {
"id": "integer",
"program_studi": "string",
},
}
Request :
- Method : GET
- Endpoint :
/api/fakultas
- Header :
- Accept: application/json
- Autohorization: Bearer token
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": [
{
"id": "integer",
"fakultas": "string",
"program_studi": [
{
"id": "integer",
"program_studi": "string",
},
...
],
},
...
]
}
Request :
- Method : POST
- Endpoint :
/api/fakultas
- Header :
- Accept: application/json
- Autohorization: Bearer token
- Body :
{
"fakultas": "string",
}
Response :
{
"status": "boolean",
"status_code": "integer",
"message": "string",
"data": {
"id": "integer",
"fakultas": "string",
"program_studi": [
{
"id": "integer",
"program_studi": "string",
},
...
],
}
}