Sidstep: Pickup Location Data

node v4.9.1
version: 2.1.0
endpointsharetweet
let got = require('got'); var endpoint = require("notebook")("runkit/json-endpoint/1.0.0"); var express = require("notebook")("runkit/express-endpoint/1.0.0"); var app = express(exports); app.get("/:show_id", (req, res) => { var showUrl = `https://production.sidestepapp.com/api/shows/${req.params.show_id}`; got(showUrl).then(result => { var jsonResponse = JSON.parse(result.body); var pickupLocationSegment = jsonResponse.shows.links.pickup_location; var pickupLocationUrl = `https://production.sidestepapp.com/api/${pickupLocationSegment}`; got(pickupLocationUrl).then(pickupLocationResponse => { var pickupLocation = JSON.parse(pickupLocationResponse.body); res.json(pickupLocation); }).catch(error => { res.json({"error 1": error.response.body}); }); }).catch(error => { console.log(error.response.body); // res.json({"error":error.respnonse.body}); res.send("HI"); }); });
Loading…

no comments

    sign in to comment