- Before starting the project, create a github repo and make an initial commit only with a Readme file, answering the following questions:
- How do you intend to approach this project? What technologies have you decided to use for each part?
- Do you find this to be particularly challenging in any of its requirements?
- If you had a lot of time to do this, what would you do differently?
- Npm v6.4.1
- Node v10.11.0 or latest - Obs: you can to use nvm to control it (:
- Docker v18.09.1
- Docker-compose v1.17
This project uses Adonis (v4.1.0) api scaffold as backend framework.
-
$ git clone https://github.com/rehnan/anthor-test-back-end.git && cd anthor-test-back-end
to download the app -
$ cp .env.example .env
to create application environment variables -
Modify only below variables in .env file (if necessary):
DB_PORT=<PORT> DB_USER=<USERNAME> DB_PASSWORD=<PASSWORD> DB_DATABASE=<DATABASE>
-
Run
npm install
to install all app dependencies -
Run
docker volume create --name=anthor-data
to create app external volumes -
Run
docker-compose up
to start a virtual machine in a docker containerized environment -
Run seed database with docker command:
docker exec -it anthor_app_1 adonis seed
-
So, you can then access the app in localhost:3223
- You can run tests with npm command:
npm run test
Authentication endpoint routes
-
BASE PATH
/v1/auth
-
Available Method:
POST
-
GET /v1/sign-in (Required: user email and password)
Login user account and return token
-
GET /v1/sign-out (Required: token)
Logout user account
-
GET /v1/authenticated (Required token)
Check authentication status from some user account
Default authentication user generated by User Seeder:
email: root@anthor.com.br
password: password
Movie endpoint routes
-
BASE PATH
/v1/movies
-
Available Method:
GET
|POST
|DELETE
|PATCH
-
GET /v1/movies (No auth required)
Return movie list
-
GET /v1/movies/:id> (No auth required)
Return movie by id
-
POST /v1/movies (Required Auth)
Create new movie and return it in response
-
PATCH /v1/movies/:id (Required Auth)
Update movie by id and return it in response
-
DELETE /v1/movies/:id (Required Auth)
Delete movie by id and return it in response