Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.

A demo URL Shortener service implemented using Azure Functions and Cosmos DB

License

Notifications You must be signed in to change notification settings

estiller/azure-functions-url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Functions URL Shortener

This repo contains a very simple URL shortener implementation. It is meant to be used as a demo for authoring Azure Functions with bindings using JavaScript. Storage is implemented with Cosmos DB.

Local Execution

In order to locally edit and execute code you need to install:

  1. Visual Studio Code
  2. Node.js
  3. The Azure Functions extension for Visual Studio Code
  4. Either the Cosmos DB emulator (Windows Only) or a Cosmos DB account on Azure.

To edit the code, simply open the folder in VSCode. First, add a local.settings.json file, and add an entry named RegistrationsDB which points to your Cosmos DB account (either online or emulator). Then, execute the functions app locally by running npm start.

Registering a URL

Send a URL registration command by running the terminal command:

curl -v -X POST -H 'Content-Type: application/json' \
  -d '{ "url": "http://mydomain.com", "vanity": "shortname" }' \
  http://localhost:7071/register

Getting a Redirect

In order to get a redirect, run the following command in the terminal:

curl -v -X GET http://localhost:7071/shortname

About

A demo URL Shortener service implemented using Azure Functions and Cosmos DB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published