Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 950 Bytes

README.md

File metadata and controls

40 lines (30 loc) · 950 Bytes

npm npm

GoEuro API

GoEuro API for Node.js.

Installation

npm install goeuro-api --save

How to use

import GoEuroAPI from 'goeuro-api';
const GoEuroClient = new GoEuroAPI();

// Init the search and get flights, trains and buses.
GoEuroClient.search(params)
  .then((response) => {
    GoEuroClient.flights()
      .then(flights => console.log(flights));

    GoEuroClient.trains()
      .then(trains => console.log(trains));

    GoEuroClient.buses()
      .then(buses => console.log(buses));
  })
  .catch((error) => console.log(error));

// Get buses by search_id
GoEuroClient
  .buses({ search_id: id })
  .then(buses => console.log(buses))
  .catch(error => console.log(error));