Веб-сайт Movies Explorer - это выпускной проект курса Yandex.Practicum Frontend-developer. Сайт представляет собой SPA-приложение для хранения кинопроизведений в личной библиотеки пользователя. Верстка адаптирована к различным устройствам (min 320px, max 1600px width)
Реализован следующий функционал:
- Регистрация
- Авторизация и аутентификация (стратегия - jwt-token в headers)
- CRUD операции с сущностью User
- CRUD операции с сущностью Movie
- Front-end: React.js
- Back-end: Express.js
- Database: MongoDB
- Version Control: Git and GitHub
- Containerization: Docker
- Infrastructure: Nginx and Yandex.Cloud
Для запуска приложения необходимо наличие Docker и плагина docker-compose. Запустить приложение можно находясь в главной директории проекта вызвав команду:
docker compose -f docker-compose.example.yml up --build
После окончания загрузки и поднятия контейнеров, приложение будет развернуто и доступно по адресу localhost:3000.
Регистрация пользователя
- Requst
curl -X POST http://localhost:5000/signup \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "fake@admin.com",
"password": "12345678"
}'
- Response 201 CREATED
{
"_id": "64732fe5b56e3c3be8442865",
"name": "John Doe",
"email": "fake@admin.com"
}
Авторизация пользователя
- Requst
curl -X POST http://localhost:5000/signin \
-H "Content-Type: application/json" \
-d '{
"email": "fake@admin.com",
"password": "12345678"
}'
- Response 200 OK
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NDczMmZlNWI1NmUzYzNiZTg0NDI4NjUiLCJpYXQiOjE2ODUyNzEwNzYsImV4cCI6MTY4NTg3NTg3Nn0.He4KvhqZ_Yv58fY0IyjZg37euFVxZnKogcyICj3FMIo",
"type": "Bearer"
}
Авторизация пользователя
- Requst
curl -X GET http://localhost:5000/users/me \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NDczMmZlNWI1NmUzYzNiZTg0NDI4NjUiLCJpYXQiOjE2ODUyNzEwNzYsImV4cCI6MTY4NTg3NTg3Nn0.He4KvhqZ_Yv58fY0IyjZg37euFVxZnKogcyICj3FMIo" \
-H "Content-Type: application/json"
- Response 200 OK
{
"_id": "64732fe5b56e3c3be8442865",
"email": "fake@admin.com",
"name": "John Doe"
}
Редактирование пользовательских данных
- Requst
curl -X PATCH http://localhost:5000/users/me \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NDczMmZlNWI1NmUzYzNiZTg0NDI4NjUiLCJpYXQiOjE2ODUyNzEwNzYsImV4cCI6MTY4NTg3NTg3Nn0.He4KvhqZ_Yv58fY0IyjZg37euFVxZnKogcyICj3FMIo" \
-H "Content-Type: application/json" \
-d '{
"email": "not_fake_I_promise@admin.com",
"name": "Dow John"
}'
- Response 200 OK
{
"_id": "64732fe5b56e3c3be8442865",
"email": "not_fake_i_promise@admin.com",
"name": "Doe John"
}
Добавление фильма в фильмотеку
- Requst
curl -X POST http://localhost:5000/movies/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NDczMmZlNWI1NmUzYzNiZTg0NDI4NjUiLCJpYXQiOjE2ODUyNzEwNzYsImV4cCI6MTY4NTg3NTg3Nn0.He4KvhqZ_Yv58fY0IyjZg37euFVxZnKogcyICj3FMIo" \
-H "Content-Type: application/json" \
-d '{
"country": "USA",
"director": "Christopher Nolan",
"duration": 148,
"year": "2010",
"description": "A thief who steals corporate secrets through the use of dream-sharing technology is given the inverse task of planting an idea into the mind of a C.E.O., but his tragic past may doom the project and his team to disaster.",
"image": "https://www.imdb.com/title/tt1375666/mediaviewer/rm3426651392/?ref_=tt_ov_i",
"trailerLink": "http://placeimg.com/640/480",
"thumbnail": "https://avatars.mds.yandex.net/get-kinopoisk-image/1629390/8ab9a119-dd74-44f0-baec-0629797483d7/300x450",
"movieId": 500,
"nameRU": "Начало",
"nameEN": "Inception"
}'
- Response 201 CREATED
{
"country": "USA",
"director": "Christopher Nolan",
"duration": "148",
"year": "2010",
"description": "A thief who steals corporate secrets through the use of dream-sharing technology is given the inverse task of planting an idea into the mind of a C.E.O., but his tragic past may doom the project and his team to disaster.",
"image": "https://imdb.com/title/tt1375666/mediaviewer/rm3426651392?ref_=tt_ov_i",
"trailerLink": "http://placeimg.com/640/480",
"thumbnail": "https://avatars.mds.yandex.net/get-kinopoisk-image/1629390/8ab9a119-dd74-44f0-baec-0629797483d7/300x450",
"owner": "64732fe5b56e3c3be8442865",
"movieId": 500,
"nameRU": "Начало",
"nameEN": "Inception",
"_id": "6473374af2532f5c4fd3635f"
}
Получение списка фильмов из фильмотеки
- Requst
curl -X GET http://localhost:5000/movies/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NDczMmZlNWI1NmUzYzNiZTg0NDI4NjUiLCJpYXQiOjE2ODUyNzEwNzYsImV4cCI6MTY4NTg3NTg3Nn0.He4KvhqZ_Yv58fY0IyjZg37euFVxZnKogcyICj3FMIo" \
-H "Content-Type: application/json"
- Response 200 OK
[
{
"_id": "647334aef2532f5c4fd36355",
"country": "La Mirada",
...
"nameEN": "Lakin and Sons"
},
{
"_id": "6473370ef2532f5c4fd36359",
...
"nameRU": "Начало",
"nameEN": "Inception"
},
...
]
Удаление фильма из фильмотеки
- Requst
curl -X DELETE http://localhost:5000/movies/6473370ef2532f5c4fd36359 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NDczMmZlNWI1NmUzYzNiZTg0NDI4NjUiLCJpYXQiOjE2ODUyNzEwNzYsImV4cCI6MTY4NTg3NTg3Nn0.He4KvhqZ_Yv58fY0IyjZg37euFVxZnKogcyICj3FMIo" \
-H "Content-Type: application/json"
- Response 204 NO CONTENT