Git Product home page Git Product logo

movie's Introduction

Project Name

This project is made for recruitment at Netguru.

Table of Contents

General Information

Its main task is to store information about movies. This is done on the basis of the title entered by the user, then the title is sent to a third-party database and from there information such as full movie title, release date, genre(s) and director are fetched and saved.

Technologies Used

  • Typescript - version 4.0.3
  • Nestjs - version 7.6.0
  • Mongodb - version 3.6.9
  • Jest - version 26.6.3

Installation

$ npm install

Running the app

# development
$ npm start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

API

Sign in

POST http://localhost:8080/auth/login

BODY PARAMETER (required) Basic user

{
    "username": "basic-thomas",
    "password": "sR-_pcoow-27-6PAwCD8",
}

Premium user

{
    "username": "premium-jim",
    "password": "GBLtTyq3E_UNjFnpo9m6",
}

RESPONSE On success, the HTTP status code in the response header is 201 Created and the response body contains an access token which is required to add movies.

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEyMywidXNlcklkIjoxMjMsIm5hbWUiOiJCYXNpYyBUaG9tYXMiLCJyb2xlIjoiYmFzaWMiLCJpYXQiOjE2MjM3NzcxMDksImV4cCI6MTYyMzc3ODkwOSwiaXNzIjoiaHR0cHM6Ly93d3cubmV0Z3VydS5jb20vIn0.s4qnaal4fFPgRBrJXne4FQ9pW-NOEipwkLGYU_6xzQI"
}

Get movies

GET http://localhost:8080/movies

Response On success, the HTTP status code in the response header is 200 OK and the response body contains an array of objects in JSON format.

[
    {
        "title": "Star Wars: Episode IV - A New Hope",
        "released": "1977-05-24T23:00:00.000Z",
        "genre": "Action, Adventure, Fantasy, Sci-Fi",
        "director": "George Lucas",
        "authorId": 123,
        "added": "2021-06-15T22:18:44.573Z",
        "id": "74d6c0e6-8ff8-488f-9f92-93a52391a10d"
    },
    {
        "title": "Rick and Morty",
        "released": "2013-12-01T23:00:00.000Z",
        "genre": "Animation, Adventure, Comedy, Sci-Fi",
        "director": "N/A",
        "authorId": 123,
        "added": "2021-06-15T22:18:58.857Z",
        "id": "e2b13a2f-80b5-451f-802d-5c587abecb85"
    }
]

Post movies

POST http://localhost:8080/movies

HEADER (required) A valid user access token

Authorization: Bearer <string>

BODY PARAMETER (required)

{
    "title": <string>
}

Response On success, the HTTP status code in the response header is 201 Created.

Test

# run tests
$ npm run test

# watch mode
$ npm run test:watch

# unit tests
$ npm run test:unit

# integration tests
$ npm run test:int

# test coverage
$ npm run test:cov

Docker

To run dockerized application

docker pull mszpila/movie
docker run -p 8080:8080 movie

movie's People

Contributors

mszpila avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.