@ply-ct/ply-movies
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

ply-movies

A simple, self-contained movies API for REST service testing.
The included data contains horror movies from the 1930s.

The ply-movies API is used by Ply in its automated tests and tutorials.

Install:
npm install -g @ply-ct/ply-movies

Start:
ply-movies start

Stop:
ply-movies stop

Configuration

CLI Option Environment Variable Default Usage
--port SERVER_PORT 3000 API server should listen on this port
--indent RESPONSE_INDENT 0 Format JSON response with this number of spaces
--file MOVIES_FILE movies.json Location of writeable movies JSON file (created on first update)
--readonly READONLY_API false Disallow POST, PUT, PATCH and DELETE requests
--delay 0 Impose a delay in milliseconds on response

For example: ply-movies start -p 3001

Sample queries

These URLs point against ply-ct.org. However, the main point of ply-movies is to be hosted locally so that during development you can exercise all API methods, including POST, PUT, PATCH and DELETE.

All movies:

Movies made in 1931:

Movies made after 1935:

Movies sorted by rating in descending order:

Movies with a rating of 3.5 or above, sorted by year:

Find all movies with Bela Lugosi:

Retrieve the first page of movies, with page size = 25

Retrieve the second page of movies, with page size = 25

Retrieve the first page of movies from a list sorted by year

Retrieve the first page of movies featuring Boris Karloff, sorted by year

Sample POST

Create a movie by posting to /movies:

{
  "title": "The Case of the Howling Dog",
  "year": 1934,
  "credits": [
    {
      "name": "Alan Crosland",
      "role": "director"
    },
    {
      "name": "Warren William",
      "role": "actor"
    },
    {
      "name": "Mary Astor",
      "role": "actor"
    },
    {
      "name": "Allen Jenkins",
      "role": "actor"
    },
    {
      "name": "Grant Mitchell",
      "role": "actor"
    },
    {
      "name": "Helen Trenholme",
      "role": "actor"
    }
  ],
  "webRef": {
    "ref": "tt0024958",
    "site": "imdb.com"
  }
}

More examples

See Ply tests in the ply-demo repository.

Package Sidebar

Install

npm i @ply-ct/ply-movies

Weekly Downloads

1

Version

1.2.4

License

MIT

Unpacked Size

275 kB

Total Files

31

Last publish

Collaborators

  • rich_tq_1
  • donoakes
  • ply-org