GithubHelp home page GithubHelp logo

xrides's Introduction

  • Task

XRides, delivers about 200 rides per minute or 288,000 rides per day. 
Now,they want to send this data to your system via an API. Your task is to create this     
API and save the data into PostgreSQL.The API should be designed, keeping in mind the real-time streaming nature of data and the
burst of requests at peak times of the day. The user of this API expects an acknowledgment,
that the data is accepted and a way to track if the request fails.

  • Pre-Requisites

Node.js Express.js PostgreSQL JavaScript, HTML


  • Implemenation of the REST API rides

Inserts the data provided by the user in the Data Base

  • URL

    /rides:

  • Method:

    POST

  • Data Params

    Required:

    bookingId=[integer] userId=[integer] vehicleId=[integer] packageId=[integer] travelTypeId=[integer] travelId=[integer] mobileId=[integer] desktopId=[integer] fromAreaId=[integer] toAreaId=[integer] fromId=[integer] destId=[integer] begDate=[integer] endDate=[DATE] fromLat=[TEXT] fromLong=[TEXT] toLat=[TEXT] toLong=[TEXT]

  • Success Response:

    • Code: 200
      Content: {message: "Your Requested has been accepted" }
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { message : "Could not process the request, Try again" }
  • Handling a large number of Requests

    • Load Balancing --> We will use the concept of Load Balancing for handling a large number of request

  • Sample Call

    route.post("/", (req, res, next) => {
    Ride.addRide(
                // Sending request with desired parameters 
          )
          .then(() => {
                // Render accepted
          })
          .catch((err) => {
                // Render failed
          })
    })
    

  • Setting Up


  • Download the essential node modules
    npm install

    Download and setup PostgreSQL
    PostgreSQL

    Start the Server
    npm start server.js 

xrides's People

Contributors

reapedjuggler avatar

Watchers

James Cloos avatar  avatar

Forkers

lilsim

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.