Skip to content

raphamorim/api-sample

Repository files navigation

API Sample

Requirements

This project needs an API key of The Movie DB, it's configure as THEMOVIEDB_API_KEY. So before anything, run:

$ export THEMOVIEDB_API_KEY=<my-api-key>

Installation

Quick way

This command is the fastest way, it will run all the installation processes to you:

$ bash <(curl -s https://raw.githubusercontent.com/raphamorim/api-sample/main/install.sh)

Regular way

Install dependencies:

$ yarn

Docker is optional but recommended, if you don't want to use docker, run the following commmand on project root and skip to Running section:

$ yarn start

Using docker, run the following commands to build and run the API:

$ make build && make run

Run docker ps, to check the container running, it should return something like this:

docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                    NAMES
e6b7a92af9d7        raphamorim/api-rest-sample   "docker-entrypoint.s…"   9 seconds ago       Up 8 seconds        0.0.0.0:8000->8080/tcp   happy_buck

Check if the API is running:

$ curl localhost:8080/health
RUNNING

Running

The API have 2 routes: /health and /trailers

/health

$ curl -X GET -H "Content-type: application/json"  -H "Accept: application/json" -d '{"url":"https://content.viaplay.se/pc-se/film/bad-boys-for-life-2020"}' "http://localhost:8080/health"
Result
RUNNING

/trailers

$ curl -X GET -H "Content-type: application/json"  -H "Accept: application/json" -d '{"url":"https://content.viaplay.se/pc-se/film/bad-boys-for-life-2020"}' "http://localhost:8080/trailers"
Result
[
  'https://www.youtube.com/watch?v=jKCj3XuPG8M',
  'https://www.youtube.com/watch?v=-P-C6I-jZwQ'
]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published