This is a Laravel api project for relaxing songs mobile application.
This project is created for a job application. You can find also usages of below instructions.
- Seeders & Factories usage.
- Laravel Sanctum implementation example.
- Global Response Class example.
- Laravel (Nginx, Php, Mysql) Docker usage.
These installations will get you a copy of the project up and running on your local machine for development and testing purposes.
cp .env.example .env
composer install
docker-compose up -d
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan migrate
docker-compose exec app php artisan db:seed
- Register
Below user is generated by UserSeeder. Use returned Token for all requests below.curl --location --request POST 'http://localhost:8282/api/register' \ --form '[email protected]' \ --form 'password=password' \ --form 'device_name=android'
- Category Related
- All Categories
curl --location --request GET 'http://localhost:8282/api/category' \ --header 'Authorization: Bearer $TOKEN'
- Get All Songs belongs given Category ID
You should change $ID on url with numeric value.curl --location --request GET 'http://localhost:8282/api/category/$ID' \ --header 'Authorization: Bearer $TOKEN'
- All Categories
- Favorite Related
- Get User's favorite songs
curl --location --request GET 'http://localhost:8282/api/favorite' \ --header 'Authorization: Bearer $TOKEN'
- Add a song to User's favorite songs
You should change $SONGID on form with numeric value.curl --location --request POST 'http://localhost:8282/api/favorite' \ --header 'Authorization: Bearer $TOKEN' \ --form 'song_id=$SONGID'
- Delete a song from User's favorite songs
You should change $SONGID on form with numeric value.
curl --location --request DELETE 'http://localhost:8282/api/favorite/$SONGID' \ --header 'Authorization: Bearer $TOKEN'
- Get User's favorite songs