Skip to content

Instantly share code, notes, and snippets.

@estiller
Created July 9, 2020 20:13
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 estiller/6e46fe04970161aadde22789ce973765 to your computer and use it in GitHub Desktop.
Save estiller/6e46fe04970161aadde22789ce973765 to your computer and use it in GitHub Desktop.
Building a Custom URL Shortener Using Azure Functions and Cosmos DB - Adding the URL Redirect Endpoint
module.exports = async function (context, req, registration) {
context.log("Url redirect triggered");
if (registration) {
return {
res: {
status: 302,
headers: {
Location: registration.url,
},
},
};
}
return { res: { status: 404 } };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment