FlixFlex is a backend for Movie app build with Laravel 10
The solution consists of providing a backend to handel :
- login and registration of user
- display list of movies/series with filter of type or search by specif title
- show a movies/series in more detail
- add user her favorites films/series into his lists
if you have docker installed in your system you can just follow this instruction Laravel sail instruction
else the requirement are PHP >= 8.1 , Mysql database 8.0 ,composer
- Install composer packages
composer install
- Set up .env file
cp .env.example .env
- seed a data for test
php artisan migrate:fresh --seed --seeder=AppSeeder
- Run Test
php artisan test
- Run PHP Internal server
php artisan serve
For this application following the specs I had to use 4 tables
- contents => to save the info of the movies and series
- users => for the users of the application
- categories => for a different kind of content for the moment we have only two kinds of movies and series
- user_content => to save the favorite content (movies/series) of the users
For this application we have 7 endpoint I provided you a tool directly into the app to test this endpoint
on {{BASE_URL}}/
or use postman,insomnia... if you prefer
Route | Methode | Params | Response | Description |
---|---|---|---|---|
api/auth/login | POST | {"name":"test_app","password":"password"} |
{ "token_type": "Bearer", "access_token": "$token", "expires_in": "60" } |
For the login of user |
api/auth/register | POST | {"name":"test_app","password":"password"} |
{ "token_type": "Bearer", "access_token": "$token", "expires_in": "60" } |
to register new user |
api/contents | GET | Optional {"type":"Movies/series","q":"search_keyword"} |
{ "data": [ { "id": 3, "title": "nihil", "description": "Omnis est voluptatem consectetur quia est. Omnis quia delectus quo nostrum temporibus quod deserunt.", "thumbnail_url": "http://www.willms.info/", "rating": "3.0", "trailer_url": "http://www.bruen.com/adipisci-quaerat-temporibus-voluptatibus-architecto-odit-vero-nisi.html", "created_at": "2023-02-24T01:23:23.000000Z", "updated_at": "2023-02-24T01:23:23.000000Z", "category_id": 2, "is_favorites": true, "category": { "id": 2, "name": "SERIES", "created_at": "2023-02-24T01:23:23.000000Z", "updated_at": "2023-02-24T01:23:23.000000Z" } }, ... ], "links": { "first": "http://0.0.0.0:8080/api/contents?page=1", "last": "http://0.0.0.0:8080/api/contents?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "http://0.0.0.0:8080/api/contents?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "path": "http://0.0.0.0:8080/api/contents", "per_page": 10, "to": 8, "total": 8 } } |
to get lists of series movies, you can use filter - to get only series or movies using query key 'type' - search with specif title using 'q' it paginate by 10 but you can change this in the env of the app using key CONTENT_LIMIT_PAGE |
api/contents/top | GET | Optional {"type":"Movies/series","q":"search_keyword"} |
{ "data": [ { "id": 3, "title": "nihil", "description": "Omnis est voluptatem consectetur quia est. Omnis quia delectus quo nostrum temporibus quod deserunt.", "thumbnail_url": " http://www.willms.info/" , "rating": "3.0", "trailer_url": " http://www.bruen.com/adipisci-quaerat-temporibus-voluptatibus-architecto-odit-vero-nisi.html" , "created_at": "2023-02-24T01:23:23.000000Z", "updated_at": "2023-02-24T01:23:23.000000Z", "category_id": 2, "is_favorites": true, "category": { "id": 2, "name": "SERIES", "created_at": "2023-02-24T01:23:23.000000Z", "updated_at": "2023-02-24T01:23:23.000000Z" } }, ...] } |
to get lists of top rating series movies, you can use filter - to get only series or movies using query key 'type' - search with specif title using 'q' it paginate by 5 but you can change this in the env of the app using key TOP_LIMIT |
api/contents/{content} | GET | { "data": { "id": 1, "title": "neque", "description": "Enim alias voluptatem quo ea iste odio dolores facere. Sit nostrum ipsum architecto voluptatum eligendi incidunt. Natus voluptas sint ea voluptatibus voluptatem illum est.", "thumbnail_url": "http://www.green.com/voluptate-alias-hic-aut-vitae.html", "rating": "4.0", "trailer_url": "http://www.durgan.com/libero-libero-atque-iusto-sunt-assumenda", "created_at": "2023-02-25T03:45:23.000000Z", "updated_at": "2023-02-25T03:45:23.000000Z", "category_id": 1, "is_favorites": false, "category": { "id": 1, "name": "MOVIE", "created_at": "2023-02-25T03:45:23.000000Z", "updated_at": "2023-02-25T03:45:23.000000Z" } } } | to get detail, | |
api/contents/{content}/favorites | POST | { "data": { "id": 1, "title": "neque", "description": "Enim alias voluptatem quo ea iste odio dolores facere. Sit nostrum ipsum architecto voluptatum eligendi incidunt. Natus voluptas sint ea voluptatibus voluptatem illum est.", "thumbnail_url": " http://www.green.com/voluptate-alias-hic-aut-vitae.html" , "rating": "4.0", "trailer_url": " http://www.durgan.com/libero-libero-atque-iusto-sunt-assumenda" , "created_at": "2023-02-25T03:45:23.000000Z", "updated_at": "2023-02-25T03:45:23.000000Z", "category_id": 1, "category": { "id": 1, "name": "MOVIE", "created_at": "2023-02-25T03:45:23.000000Z", "updated_at": "2023-02-25T03:45:23.000000Z" } } } |
add or remove movie or series for favorites list | |
api/me/favorites | GET | { "data": [ { "id": 3, "title": "nihil", "description": "Omnis est voluptatem consectetur quia est. Omnis quia delectus quo nostrum temporibus quod deserunt.", "thumbnail_url": " http://www.willms.info/" , "rating": "3.0", "trailer_url": " http://www.bruen.com/adipisci-quaerat-temporibus-voluptatibus-architecto-odit-vero-nisi.html" , "created_at": "2023-02-24T01:23:23.000000Z", "updated_at": "2023-02-24T01:23:23.000000Z", "category_id": 2, "is_favorites": true, "category": { "id": 2, "name": "SERIES", "created_at": "2023-02-24T01:23:23.000000Z", "updated_at": "2023-02-24T01:23:23.000000Z" } }, ...] } |
get a lists of user favorites movies or series |