Created
July 4, 2019 22:26
-
-
Save heyAyushh/cb423f50744ab4815621dd5417998150 to your computer and use it in GitHub Desktop.
Basic url redirector on Azure functions
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
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