/movie-api

Primary LanguageTypeScript

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Description

This repository contains a NestJS-based API for managing a list of favorite movies. It includes authentication and authorization using JWT.

Requirements

  • Docker
  • Docker Compose

Installation

  1. Clone the repository:

    git clone https://github.com/your-repo/movie-api.git
    cd movie-api
    
  2. Create a .env file in the root directory and add your environment variables:

DB_HOST=db DB_PORT=3306 DB_USERNAME=root DB_PASSWORD=your_password_here DB_NAME=movies_db JWT_SECRET=your_jwt_secret_here

API Endpoints

Authentication

  • POST /auth/login: Logs in a user and returns a JWT token.
  • POST /auth/register: Registers a new user.

Movies

  • GET /movies: Returns a list of favorite movies.
  • GET /movies/:id: Returns a movie by ID.
  • POST /movies: Creates a new movie.
  • PUT /movies/:id: Updates a movie by ID.
  • DELETE /movies/:id: Deletes a movie by ID.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
# Build and start the containers:
$ docker-compose up --build

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Replace placeholders like your-repo, your_password_here, your_jwt_secret_here, Your Name, Your Website, and @yourtwitterhandle with your actual project details and author information. This structure integrates your specific project setup into the NestJS README template effectively.