Skip to content

Instantly share code, notes, and snippets.

@mattzeunert
Created August 16, 2018 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattzeunert/cacc7144de9ef856f2e602beb12b1325 to your computer and use it in GitHub Desktop.
Save mattzeunert/cacc7144de9ef856f2e602beb12b1325 to your computer and use it in GitHub Desktop.
var request = require("request");
app.get("/weather/:cityId", (req, res) => {
request("http://weatherapithing.com/" + req.params.cityId, function(
error,
response,
body
) {
console.log("error:", error); // Print the error if one occurred
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.send(body)
res.end()
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment