Skip to content

Instantly share code, notes, and snippets.

@heyAyushh
Created July 4, 2019 22:26
Show Gist options
  • Save heyAyushh/cb423f50744ab4815621dd5417998150 to your computer and use it in GitHub Desktop.
Save heyAyushh/cb423f50744ab4815621dd5417998150 to your computer and use it in GitHub Desktop.
Basic url redirector on Azure functions
module.exports = async function(context, req) {
context.log("JavaScript HTTP trigger function processed a request.");
if (req.query.url) {
context.res
.status(302)
.set("location", req.query.url)
.send();
} else {
context.res
.status(400)
.body("Please pass a url on the query string")
.send();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment