Skip to content
Luigi Minardi edited this page Apr 18, 2022 · 5 revisions

Go to Home

Movies, as the name implies, are the movies that are in our database and you can access them through our API endpoints.

Movies Fields

field field type field options
id integer !null, auto, f++, unq, pk
title string !null, unq
description string !null
adult boolean !null
popularity float
image string
date string
createdAt date !null, auto
updatedAt date !null, auto

Unique fields

The title of the movies table are unique so you can't have two movies with the same title.

Age verification

The field adult is resposible to allow access of only adults to some movies.

Endpoints

The default endpoint is <path>:<port>/movies.

Example: http://localhost:3000/movies, path is http://localhost, port is 3000.

Check the CRUD

To see the expected response click on the function, you'll be redirected to the page that specifies its behavior.

The path / is for the default endpoint, whatever after it will be after the default endpoint (/favorites => <path>:<port>/movies/favorites)

method function path check
POST add new movie to db / auth, adm
GET return all movies that are not for adults /
GET return all adult movies with specified title and popularity /favorites auth
GET return all movies that are for adults /adult auth, +18
GET return movie with specified pk, if user is underage and movie for adult, return forbidden /:pk<integer> auth
PUT edit movie by pk /:pk<integer> auth, adm
DELETE delete movie by pk /:pk<integer> auth, adm