Giter VIP home page Giter VIP logo

attraction-in-cities's Introduction

Attractions in some cities

A simple web application made by Express framework to test the APIs of OpenWeatherMap and Yelp.

Focus

Develop a simple server that in turn invokes third-party APIs by manipulating the data.

Features

The following cases were tested

  • Missing or incorrect tokens
  • Misspelled cities
  • Wrong third-party APIs path
  • Incorrect primary endpoint input

more informations

  • There isn't defined number of input cities to put, but the code has been tested up to 5 cities (sydney, london, boston, paris, osaka).
  • The number of businesses to display has been limited to 5. This setting can be changed from the settings.js file.
  • A simple input validator has been added: Joi.
  • You can have more informations about the endpoint by browser at the follow address /api-docs. You can also test them on the endpoint by entering the cities as input and clicking on Execute

Screenshot

Requirements

  • nodeJS v14.5.0

Getting Started

Install all dependencies with the follow command:

npm install

To be sure it work properly use this command as well

node --experimental-specifier-resolution=node index

Start the application with:

npm start

Environment variable

In the root of project create a file named .env with the following keys:

YELP_AUTHORIZATION=
OPEN_WEATHER_MAP_APP_KEY=

The values of these keys will be the authorization tokens of the third party services.

Example

After started and setted the app the following endpoint (GET method) will be exposed

/getInformations

this endpoint needs to have input cities as querystring like this

http://localhost:3000/getInformations?cities=sydney

the answer will be similar to:

[
    {
        "city": "sydney",
        "businesses": [{
            "name": "Social Brew Cafe",
            "categories": [ "Cafes", "Breakfast & Brunch", "Coffee & Tea" ],
            "location": "224 Harris St"
        }],
        "weather": {
            "description": ["clear sky"],
            "tempMin": 288.76,
            "tempMax": 292.93,
            "humidity": 51
        }
    }
]

you can also get informations of more cities separating it by commas like

http://localhost:3000/getInformations?cities=sydney,london,boston

Author

Marco Pestrin ([email protected])

attraction-in-cities's People

Contributors

marcopestrin avatar

Watchers

 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.