luigimorel / movies-backend

A movie API to show movie directors and their movies (Docker, testing, MongoDB)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

Movies REST API

The task

  • Build a REST API to show movie directors

Solutions

Here's the Postman Collection

Tools used

  • Typescript
  • Node.js (Express)
  • MongoDB
  • Docker
  • NPM

Set up instructions

  1. Clone the repository
$ git clone https://github.com/morelmiles/backend-task
  1. Install the dependencies
$ npm install
  1. Create a database (I use Docker on local machine)
$ docker pull mongo # Pull the mongo image from Docker Hub
$ docker run --name some-name -d mongo:tag  # Create a container
$ docker exec -it some-name sh # Terminal for the mongo container
$ root@3fdfdadd6690:/# mongosh # Launch mongo's shell
$ test> use boilerplate # Create a database named boilerplate
$ boilerplate # Database created succesfully
  1. Copy the env variables and fill in the details
$ cp .env.example .env
  1. Start the dev server
$ npm run dev

Improvements

  • Use a separate database for running tests
  • Mock the database connection using mongodb-memory-server
  • Add deployment scripts using Docker and docker-compose

About

A movie API to show movie directors and their movies (Docker, testing, MongoDB)

License:MIT License


Languages

Language:TypeScript 92.8%Language:JavaScript 6.2%Language:Dockerfile 1.0%