Code Monkey home page Code Monkey logo

movies-be-task's Introduction

movies-be-task

This is a simple REST API for movies management. It is written in JavaScript using Node.js and Express.js, sequelize ORM and sqlite3 database.

There are 3 main entities: users, movies and actors. Users can register and login to the system. After that they can create and manage movies.

Movies and actors are connected with many-to-many relationship, using through table ActorMovie.

Main app logic is inside app folder.

app.js - main app file, where routes and global middleware are connected and app is initialized.
db.js - file for database initialization and connection.

routes folder contains all routes for the app. Each route group has router, controller with logic, validation schema file.

middlewares folder contains all middlewares for the app:

  • validator middleware is used for validation of requests, before it goes to the controller.
  • auth middleware is used for authentication of users. It checks that JWT token exists and valid.
  • errorHandler global error handler for any uncatched errors.

How to run

Build Docker image:

docker build . -t alexrazor/movies

OR

Get the latest version from Docker Hub:

docker pull alexrazor/movies:latest

Run app using Docker:

docker run --name movies -p 8000:8050 -e APP_PORT=8050 alexrazor/movies

Possible ENV variables for configuration

APP_PORT - port for the app to listen inside a container, default - 8050
JWT_SECRET - secret for JWT token generation/verification, default - secret
DB_PATH - path to the sqlite3 database file inside a container - default - ./db.sqlite

movies-be-task's People

Contributors

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