This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0xcc2d6ea8ad9c529490a936087fea24acede0acfc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Client = require('node-rest-client').Client; | |
const postcode = 'SW1A1AA'; // Or whatever postcode you're looking for | |
const uri = `https://mapit.mysociety.org/postcode/${postcode}`; | |
const getConstituency = uri => new Promise((resolve, error) => | |
{ | |
const client = new Client(); | |
client.get(uri, (data, response) => { | |
constituencyCode = data.shortcuts.WMC; |