Git Product home page Git Product logo

yassir-test's Introduction

Yassir

Coding challenge

The problem:

Task: Air quality information

  • The goal of this project is to create a REST API responsible for exposing “the air quality information” of a nearest city to GPS coordinates using iqair.com API.
  • Implement CRON JOB to check “ air quality “ for the Paris zone ( latitude: 48.856613 ,longitude: 2.352222) every 1 minute than save them in the database ( add date and time when saving the air quality)

The solution:

Focuses on Backend only

Functionalities through API:

  • Get air quality information of a nearest city to GPS coordinates
    • GET /iqair/cities?lat=tttt&lon=nnnn
  • POST /iqair/cities?lat=tttt&lon=nnnn
    • This API is called via scheduler every minute to get air quality information of a nearest city to GPS coordinates and save it in the database.

Technologies

Nodejs, Expressjs, MongoDB, Mongoose, Jest, Docker, Docker Compose

Technical descisions:

  • Scheduler is a separate service to make the api more scalable by separating the scheduler from the api.
  • Add the API and the scheduler in the same repository for simplicity.
  • Add extra attributes(city, state, country) to the city-pollution model to make it more usable if we want to add more functionalities in the future.
  • Express, is a very lightweight framework.
  • MongoDB one of the most famous document database.
  • Jest and superagent for unit and integration testing

Linked:

https://www.linkedin.com/in/ahmed-elbassel/

API Documentation

GET: localhost:3000/iqair/cities?lat=tttt&lon=nnnn POST: localhost:3000/iqair/cities?lat=tttt&lon=nnnn

  • This API is called via scheduler every minute.

Initial data

A script is used to store 400 customers for the first time app runs to allow you to use rest of APIs.

Run App

  • Clone the repo, and go inside it then the below command, if the commands don't run, try it with sudo:
git clone [email protected]:elbassel/yassir-test.git
cd yassir-test
docker-compose build
docker-compose up

Run tests

npm run test

Linting

npm run lint

yassir-test's People

Contributors

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