Program | Version |
---|---|
NodeJS | 14.16.1 |
npm | 7.11.2 |
docker | 20.10.5 |
docker-compose | 1.29.0 |
Command | Description |
---|---|
npm install | Install required dependencies |
npm run bootstrap | Bootstrap dependencies |
npm run prisma:generate | Generate types based on schema |
npm test | Run tests in all packages |
docker-compose up -d | Start database in detached mode |
npm run start:dev | Run server in development mode |
npm run build | Compile server |
npm run start | Run compiled server |
If you want to "dockerize" this application, in ".env" file, replace "DATABASE_URL" "localhost" with name of your database container in "docker-compose"`.
For example "postgresql://nscode:password@localhost:5432/movie-api?schema=movie_api" will be replaced with "postgresql://nscode:password@db:5432/movie-api?schema=movie_api"
# payload
# application/json
{
email: "[email protected]",
password: "P@ssw0rd!11",
type: 1 # Premium user | 0 Basic user,
username: "nickname",
}
# response
# application/json
{
status: 'success'
}
# payload
# application/json
{
email: "[email protected]",
password: "P@ssw0rd!11",
}
# response
# application/json
{
token: "Bearer 0658010ff6f8f5c456f06835025f88"
}
Require: authentication: Bearer <token>
# response
# application/json
{
token: "0658010ff6f8f5c456f06835025f88",
userId: 1
}
Require: authentication: Bearer <token>
# payload
# application/json
{
title: "Joker",
}
# response
# application/json
{
status: 'success'
}
Require: authentication: Bearer <token>
# response
# application/json
{
data: [
{
title: "Joker",
director: "Todd Phillips",
released: "04 Oct 2019",
genre: "Crime, Drama, Thriller"
}
]
}
cat .env.example > .env
PUT YOUR API_KEY TO .env
🙈
# .env
API_KEY=<you-api-key>
npm run test
npm install
npm run bootstrap
docker-compose up -d
npm run build
npm run start
docker-compose build
docker-compose up