Skip to content

Instantly share code, notes, and snippets.

@estiller

estiller/index.js

Created Jul 9, 2020
Embed
What would you like to do?
Building a Custom URL Shortener Using Azure Functions and Cosmos DB - Authoring the URL Registration Endpoint
module.exports = async function (context, req) {
context.log("Url registration triggered");
if (req.body && req.body.url && req.body.vanity) {
return {
registration: {
id: req.body.vanity,
url: req.body.url,
},
res: {
status: 204,
},
};
}
return {
res: {
status: 400,
body:
"Please pass a a request body containing a url, vanity url and a submitted by fields",
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.