Giter Site home page Giter Site logo

be_challenge's Introduction

Backend Code Challenge

Create an express application exposing a single endpoint (/terms/{tid}/longest-preview-media-url) that returns the longest preview media URL. The term id ({tid}) will be used to supply an initial, internal API call to the Gaia backend.

Your response from the endpoint should look something like this:

{

"bcHLS": "https://www.gaia.com/api/brightcove/proxy/96371/master.m3u8?expiration=1455832800&token=c522231dbad02ae0d5a9676c8c9f9d8df86d2181280df53b46ab0b24b257458a",

"titleNid": 100176,

"previewNid": 96371,

"previewDuration": 90

}

There are three endpoints you will need to use to accomplish this task: http://d6api.gaia.com/vocabulary/1/{tid}http://d6api.gaia.com/videos/term/{tid} http://d6api.gaia.com/media/{previewNid}

Calls to the endpoints above should include the header Accept: application/json.

First, you’ll need to hit http://d6api.gaia.com/vocabulary/1/{tid} using the {tid} URL parameter in your endpoint path. Use 26681 for a testing {tid}. From this response, you’ll need to grab the first tid (26686) from the first object in the array from the terms property.

Second, you’ll hit http://d6api.gaia.com/videos/term/{tid} and supply {tid} with 26686 (retrieved programmatically).

Third, you’ll need to iterate over the response from http://d6api.gaia.com/videos/term/26686 and identify the preview node id (nid) (titles[i].preview.nid) that has the longest duration value (titles[i].preview.duration) from the array of objects from the titles property. note: this endpoint is paginated, but for this exercise you can use the first page of results

Finally, you’ll hit http://d6api.gaia.com/media/{nid} with the appropriate preview nid you determined in step 3. You’ll want to capture the URL from mediaUrls.bcHLS to include in your endpoint response.

Requirements:

Create a Github repo Must run on Node LTS/boron Must use Express library Endpoint must return JSON Errors must be handled and appropriate HTTP status codes returned Here are some additional suggestions based upon our stack and coding practices:

Demonstrate knowledge of ES2015+ language features (include transpilation if necessary) Demonstrate a firm grasp of asynchronous coding patterns (callbacks, promises, generators, async/await, whatever you prefer, but be consistent) Demonstrate familiarity with testing node applications (both unit & integration tests as well as code coverage, we use mocha/chai/sinon/istanbul, but feel free to use whatever stack you're comfortable with) Demonstrate a solid understanding of best practices regarding code/project organization and programming principles (SOLID, GRASP, 12 Factor App, etc) Include a Dockerfile with instructions for testing & running

be_challenge's People

Contributors

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