Giter Site home page Giter Site logo

api-sample's Introduction

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'
]

api-sample's People

Contributors

raphamorim avatar

Watchers

 avatar  avatar  avatar

Forkers

rogefm

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.