FsHafas-JavaScript
    Preparing search index...

    FsHafas-JavaScript

    FsHafas-JavaScript is a client for the HAFAS public transport APIs. It is generated (via Fable) by the fshafas F# library.

    JavaScript app using fshafas and hafas-client npm packages (see HafasClient interface)

    import { createClient } from 'hafas-client';
    import { profile as oebbProfile } from 'hafas-client/p/oebb/index.js';

    import { fshafas } from 'fs-hafas-client';
    import { profiles } from 'fs-hafas-profiles';

    const args = process.argv.slice(2);

    /** @type {HafasClient} */
    const client = args[0] === "fshafas" ? fshafas.createClient(profiles.getProfile('db')) : createClient(oebbProfile, 'agent');

    const locations = (name) => {
    client.locations(name, { results: 3, linesOfStops: true })
    .then(result => { result.forEach(s => { console.log(s.type, s.id, s.name); }); })
    .catch(console.error);
    }

    locations(args[1])

    Replace x.y.z with current release.

    npm install https://github.com/bergmannjg/fshafas/releases/download/x.y.z/fs-hafas-client-x.y.z.tgz
    npm install https://github.com/bergmannjg/fshafas/releases/download/x.y.z/fs-hafas-profiles-x.y.z.tgz
    npm install hafas-client