Git Product home page Git Product logo

temperature-api's Introduction

Temperature-API

Instructions

  1. Run npm install
  2. Run npm test
  3. Run npm start
  4. Open Browser
  5. Go to url: "http://localhost:8080/locations/
  6. To show temperature in Celsius/Fahrenheit use url: "http://localhost:8080/locations/?scale=<Celsius/Fahrenheit>"

Problem

Write an API application that allows users to check the current temperature.

The API application should provide one route:

GET /locations/{zip-code}

The response should be returned with 200 status code with a payload in JSON format as follows:

{ "temperature": number "scale": "string" }

where "temperature" is a number representing the current temperature of the specified zip code and "scale" is either "Fahrenheit" and "Celsius".

By default, Fahrenheit will be returned. However, users can optionally specify "scale" as a query string when making a call.

Example:

To get Blacksburg's current temperature:

Request:

GET /locations/24060

Response:

200

{ "temperature": 43 "scale": "Fahrenheit" }

To get Beverly Hills, California's current temperature in Celsius:

Request:

GET /locations/90210?scale=Celsius

Response:

200

{ "temperature": 25 "scale": "Celsius" }

To get Chicago's current temperature in Fahrenheit:

Request:

GET /locations/60606?scale=Fahrenheit

Response:

200

{ "temperature": 63 "scale": "Fahrenheit" }

The Data

Weather data can be obtained from Yahoo.

More information is available at: https://developer.yahoo.com/weather/

Requirements

Must Haves

These are the requirements your submission must fulfill to be considered correct.

  • The application is developed using either JavaScript or TypeScript.
  • The application is available at http://localhost:8080 after invoking npm install followed by npm start
  • Your code is something you'd be comfortable putting in production and having your team maintaining
  • Send us a URL to a public git repo or a zip file containing all source code and any artifacts for the solution. Please do not include any binary files.

Should Have

These should be fulfilled, but if they aren't please let us know why.

  • Your code is tested in some automated fashion when invoking npm test
  • Source control history (e.g. the .git directory or a link to Github)

Nice to Have

Stretch goals. If you fulfill these requirements, you get bonus points, but they aren't required.

  • Design rationale

Time constraint

We look forward to reviewing your solution within a few day from the time we sent this assignment to you.

temperature-api's People

Contributors

tanaynigam avatar

Watchers

James Cloos avatar  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.