Giter Site home page Giter Site logo

varshitverma / movie_director_expressjs_application Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 31 KB

CRUD Operations on movie_director_Database using NodeJS, Express JS, SQLite we can perform various operations on the database like GET (Read) , POST (Create) , PUT (Update) and DELETE(Delete). API'S can retrieve various queries using path parameters and query parameters.

JavaScript 100.00%
expressjs javascript nodejs sqlite3-database crud-api

movie_director_expressjs_application's Introduction

Movies

Given two files app.js and a database file moviesData.db consisting of two tables movie and director.

Write APIs to perform CRUD operations on the tables movie, director containing the following columns,

Movie Table

Columns Type
movie_id INTEGER
director_id INTEGER
movie_name TEXT
lead_actor TEXT

Director Table

Columns Type
director_id INTEGER
director_name TEXT

API 1

Path: /movies/

Method: GET

Description:

Returns a list of all movie names in the movie table

Response

[
  {
    movieName: "Captain America: The First Avenger",
  },

  ...
]

API 2

Path: /movies/

Method: POST

Description:

Creates a new movie in the movie table. movie_id is auto-incremented

Request

{
  "directorId": 6,
  "movieName": "Jurassic Park",
  "leadActor": "Jeff Goldblum"
}

Response

Movie Successfully Added

API 3

Path: /movies/:movieId/

Method: GET

Description:

Returns a movie based on the movie ID

Response

{
  movieId: 12,
  directorId: 3,
  movieName: "The Lord of the Rings",
  leadActor: "Elijah Wood",
}

API 4

Path: /movies/:movieId/

Method: PUT

Description:

Updates the details of a movie in the movie table based on the movie ID

Request

{
  "directorId": 24,
  "movieName": "Thor",
  "leadActor": "Christopher Hemsworth"
}

Response

Movie Details Updated

API 5

Path: /movies/:movieId/

Method: DELETE

Description:

Deletes a movie from the movie table based on the movie ID

Response

Movie Removed

API 6

Path: /directors/

Method: GET

Description:

Returns a list of all directors in the director table

Response

[
  {
    directorId: 1,
    directorName: "Joe Johnston",
  },

  ...
]

API 7

Path: /directors/:directorId/movies/

Method: GET

Description:

Returns a list of all movie names directed by a specific director

Response

[
  {
    movieName: "Captain Marvel",
  },

  ...
]

Use npm install to install the packages.

Export the express instance using the default export syntax.

Use Common JS module syntax.

movie_director_expressjs_application's People

Contributors

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