BlinkTagInc / node-gtfs

Import GTFS transit data into SQLite and query routes, stops, times, fares and more.
MIT License
442 stars 151 forks source link

Get all Stops #51

Closed seanmavley closed 8 years ago

seanmavley commented 8 years ago

I couldn't spot any function available in the package that retrieves all the stops available.

I added this to the gtfs package:

    // Copied and tweaked the agencies
    // function
    getAllStops: function(cb) {
        Stop.find({}, cb);
    },

Then tried using it as:

    var all_stops;
    router.get('/stops', function(req, res) {
        gtfs.getAllStops(function(err, data) {
            if (!err) {
                all_stops = data;
                console.log(all_stops);
            } else {
                console.log(err);
            }
        })
        res.json({ stops: all_stops });
    })

I get an empty response from the query. All the other queries worked as usual though

seanmavley commented 8 years ago

Okay, what I rolled out seems to be working now. No idea why it wasn't at first.