Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including aviasales with all npm packages installed. Try it out:

var aviasales = require("aviasales")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

aviasales v2.0.9

Aviasales

It is a Node.js implementation of TravelPayouts Flights Search API for make it easy send requests and get response

For more information see https://www.travelpayouts.com

Install

npm install aviasales

Usage

  • Search:
const aviasales = require('aviasales')

aviasales.search(
    {
        lang: 'ru',
        class: 'E',
        travelers: {
            adult: 1,
            child: 0,
            infant: 0
        },
        routes: [
            {
                from: 'MOW',
                to: 'LON',
                date: '2018-05-17'
            }
        ]
    },
    {
        marker: {MARKER},
        token: {TOKEN}
    },
    (error, solutions) => {

        console.log(JSON.stringify(error || solutions, null, 2))

    })
  • Redirect:
const aviasales = require('aviasales')

aviasales.redirect(
    {SOLUTION},
    null,
    (error, redirect) => {

        console.log(JSON.stringify(error || redirect, null, 2))

    })

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free