Coder Social home page Coder Social logo

gmdb-backend's Introduction

gmdb-backend

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have a PostgreSQL database running locally.
  • You have Tmdb account and API Key

Installing

To install gmdb-backend, follow these steps:

git clone https://github.com/gygabor/gmdb-backend.git
cd gmdb-backend

Istall dependencies

npm install

update .env

TMDB_API_KEY="<Add Tmdb API Key here>"
PORT="<Add port where your app is running>"

# DB
DB_HOST="<PostgreSQL Host>"
DB_PORT="<PostgreSQL Port>"
DB_USER="<PostgreSQL User>"
DB_PASSWORD="<PostgreSQL Password>"
DB_NAME="<PostgreSQL Db name>"

Populate the Database

Create gmdb database and movie_searches table with the initDb script

npm run initDb

Start the app

npm run start

Start with nodemon:

npm run start:dev

It starts the server running on the port what you added to the .env: http://localhost:PORT/.

Run tests:

npm run test

API Documentation

GET /movies/search

  • Query params:
    • query: string
    • page: string

Example

http://localhost:3000/movies/search?query=godfathe&page=1

Curl:

curl --location 'http://localhost:3000/movies/search?query=godfather&page=2'

Todos

  • Add Movie and Query tables to the Db instead of store them in a table
  • Add e2e tests with supertest
  • Create openapi documentation from the zod schemas with the zod-openapi package
  • Create cron job to delete the old data from the DB

gmdb-backend's People

Contributors

gygabor 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.