Giter Site home page Giter Site logo

city-suggester's Introduction

City Suggester

Coveo backend coding challenge. Project instructions can be found here.

Setup

Before anything, you must clone/download the repository.

Docker

  1. Make sure you have docker installed.
  2. Make sure you have docker-compose installed.
  3. From the root directory, run docker-compose up.
    • you can add the -d or --detach option to run containers in the background.

You should now be able to connect to the following:

API

GET /suggestions

Query Parameters

Parameter Required Description
q Yes The name the city starts with.
latitude Yes The latitude of your current location.
longitude Yes The longitude of your current location.

Sample Requests

Near Match

Request
GET /suggestions?q=Londo&latitude=43.70011&longitude=-79.4163
Response
{
    "suggestions": [
        {
            "name": "London, Ontario, Canada",
            "latitude": "42.98339080810547",
            "longitude": "-81.23303985595703",
            "score": 0.1855211690544582
        },
        {
            "name": "London, KY, USA",
            "latitude": "37.12897872924805",
            "longitude": "-84.08325958251953",
            "score": 0.005128510962492697
        },
        {
            "name": "Londontowne, MD, USA",
            "latitude": "38.933448791503906",
            "longitude": "-76.54940795898438",
            "score": 0.005553343714487146
        },
        {
            "name": "London, OH, USA",
            "latitude": "39.886451721191406",
            "longitude": "-83.44824981689453",
            "score": 0.006642495607016312
        },
        {
            "name": "Londonderry, NH, USA",
            "latitude": "42.865089416503906",
            "longitude": "-71.37394714355469",
            "score": 0.006968368987265614
        }
    ]
}

No Match

Request
GET /suggestions?q=SomeRandomCityInTheMiddleOfNowhere&latitude=43.70011&longitude=-79.4163
Response
{
  "suggestions": []
}

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.