• This repository has been archived on 22/Jan/2021
  • Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Azure Function for a URL shortening website. Uses serverless functions, Azure Table Storage and Application Insights.

Azure Functions App for URL Shortening

This project represents a fully serverless implementation for a URL shortening utility implemented with Azure Functions and Azure Table Storage. The project as deployed will enable you to create short URLs and provides an endpoint for redirecting the short URL to the target URL. It uses proxies to allow redirection from the root of the domain.

Free Azure Account Get your Free Azure Account

Deploy to Azure

This project leverages Azure Resource Management Templates to make it easy to provision with a single click.

NOTE: this represents an early version of development. The latest source code is available in the jlik.me repository.

Getting Started

This section is walkthrough to deploy and test the application. Click on the link below to watch a video that demonstrates the following steps.

Video Walk-through

For a comprehensive explanation of the source code and how the application was built, read: Build a Serverless Link Shortener with Analytics Faster than Finishing Your Latte.

Simply click on the deploy button to get started. The first dialog prompts for information needed to generate the resources.

Initial Form for Deploying to Azure

If you have multiple directories and subscriptions, choose the correct one. Pick a resource group and give your app a name. The fallback URL is the URL the service will redirect to when an invalid short URL is provided. The "UTM Source" is used for tagging social media campaigns. Both values will be updated to the application settings for the function app and may be changed at a later date. Choose the storage option (the default should be fine). Keep the default URL for the repository unless you forked the code for your own.

Note: sometimes the deployment may fail with a random error. If it does this, choose the option to try again. In my experience it will often succeed on the second try, especially if the error is related to source code (there appear to be some sporadic issues with fetching the code from GitHub).

This is what a successful screen looks like:

List of Deployment Steps

Once the project has deployed, click or tap "Manage" to navigate to the resource group in the Azure portal. Click on the function app name.

Resource List

Next, tap on the UrlIngest function to create your first short URL. Tab the "Test" tab on the right to enter a request body and specify the following:

{
    input: "https://blog.jeremylikness.com/"
}

(You can choose your own URL).

Select UrlIngest Function

Tap the "Run" button and you should receive a list of results with your shortened URL.

Short URL Response

You can either copy the "ShortUrl" property from the JSON returned, or build the link yourself from the short url. Open a browser, and paste the URL. This example assumes the app name "jrlshorturl" was used.

http://jrlshorturl-function.azurewebsites.net/2q

The site should redirect to the URL you set up in the previous step. Your URL is ready to go! To view analytics, tap on the Function App name then click the Application Insights feature.

Selecting Application Insights

You should immediately begin to see data generated from your functions app.

Client Web Tool

For your convenience, you can also create a lightweight Docker image to run a small client to make it easier to generate URLs without logging into the portal. First, navigate to the "UrlIngest" function and click "Get function URL."

Get the Function URL

Copy the value. This should include your secret function key. Next, navigate to the webApp directory and replace the value for apiRoot in first line of index.js with the URL you just copied.

const apiRoot = "https://<hostname>.azurewebsites.net/api/UrlIngest?code=<funcAppKey>";

Save the file and build the Docker image:

docker build -t shortener .

Once the image has built, run it. This example maps it from the default web port 80 to 8888.

docker run -d -p 8888:80 shortener

Navigate to http://localhost:8888 to run the app.

Shortener App

Important note about CORS: in order for the function URL to be accessible from your local browser, it must be configured with a Cross-Origin Rresource Sharing (CORS) entry in the function app. Learn how to with this link: How to manage a function app in the Azure portal.

Choose whether or not to add the configured source and redirect to the various mediums, then paste the long URL and tap "Shorten" to generate the short URLs.

Follw me on Twitter: @JeremyLikness

More Repositories

1

vanillajs-deck

A Vanilla.js Single Page App (SPA) slide deck for a presentation about Vanilla.js written with no frameworks.
JavaScript
190
star
2

BlazorWasmEFCoreExample

Example of a Blazor WebAssembly project that uses Entity Framework Core on the server for data access.
C#
152
star
3

BlazorState

Examples of how to manage state in Blazor WebAssembly and Blazor Server apps.
HTML
104
star
4

SqliteWasmHelper

Persistent SQLite in Blazor WebAssembly apps with EF Core 6.0 and your browser's cache.
C#
95
star
5

ExpressionGenerator

Example of creating dynamic LINQ expressions
C#
94
star
6

blazor-wasm

Blazor and WebAssembly examples (part of a Blazor presentation)
JavaScript
80
star
7

ExpressionPowerTools

Power tools for working with IQueryable and Expression trees.
C#
77
star
8

BlazorEFCoreMultitenant

Examples of multitenancy using EF Core and Blazor.
C#
73
star
9

explore-cosmos-db

.NET Core 2.0 project to demonstrate some capabilities of Cosmos DB
C#
71
star
10

DurableDungeon

A game designed to teach and learn serverless durable functions in C#
C#
70
star
11

PlanetaryDocs

A complete Blazor Server app using Azure Cosmos DB with EF Core.
C#
61
star
12

azure-fn-file-process-hol

Tutorial for file processing and importing to SQL leveraging serverless Azure Functions.
C#
46
star
13

jsInject

Simple & easy DI for JavaScript.
JavaScript
45
star
14

PASS-2017

Code samples for the Web API Design workshop at PASS Summit 2017
C#
43
star
15

BlazorHealthApp

Example application ported from Angular 2 to Blazor
HTML
37
star
16

sterling-net-core

This is a port of the Sterling Open Source NoSQL database to .NET Standard 2.0.
C#
35
star
17

BlazorMVVM

Implementation of MVVM pattern in Blazor
HTML
31
star
18

jlik.me

URL Shortener project.
C#
31
star
19

ShortLink

Simple version of link shortener
C#
25
star
20

BlazorOData

Build data-driven apps using LINQ and shared models with Blazor and OData.
C#
23
star
21

Angular2HealthApp

Angular Health App Ported to AngularJS 2.0 (beta)
TypeScript
22
star
22

PlasmaWasmRust

Implementation of plasma effect using WebAssembly compiled from Rust.
Rust
21
star
23

MvpSummitTaskList

Example in MVP summit of using connected services and adding (persisted) SQLite to Blazor Wasm.
HTML
21
star
24

6502emulator

Emulator for the 6502 chipset written with TypeScript and Angular 2
TypeScript
20
star
25

AzureBlazorCosmosWasm

A completely serverless solution to access Cosmos DB from Blazor WebAssembly using EF Core.
C#
19
star
26

BlazorServerEFCoreExample

Example of a Blazor Server App that reuses most of the libraries from the related Blazor WebAssembly App example.
HTML
18
star
27

jeremylikness-blog

Developer for Life Blog
HTML
17
star
28

dotnetconf2021

Demos performed by Jeremy Likness for .NET Conf 2021.
C#
16
star
29

SterlingNoSQL

Sterling NoSQL Object-Oriented Database
C#
16
star
30

usda-microservice

Simple Angular 2, Node.js microservices, and Mongo DB example using Docker compose to get up and running.
TypeScript
16
star
31

ExpressionExplorer

A simple console application to explore and transform expressions using ExpressionVisitor.
C#
16
star
32

QueryEvaluationInterceptor

An example of intercepting IQueryable executions to parse and transform the query.
C#
15
star
33

typescript-for-node

Presentation materials for Connect.Tech 2017. Covers building Node.js apps with TypeScript.
CSS
12
star
34

AdvancedBlazor

An advanced Blazor example demonstrating a Razor class library with embedded JavaScript shared between a Blazor Server and a Blazor WebAssembly project.
HTML
12
star
35

AngularTipsAndTricks

Demonstration app of various Angular Tips and Tricks for DevLink 2014 Talk
JavaScript
12
star
36

jlikness.watch

Simple module to enable counting watches in your AngularJS app.
JavaScript
12
star
37

TypeScript-from-JavaScript

Learn TypeScript through a series of refactorings to existing JavaScript code.
JavaScript
12
star
38

AsyncAwaitExplained

Async/await keywords explained: deck and source demos
C#
12
star
39

redux-adventure

A text adventure written with Redux, Angular 2 and TypeScript.
TypeScript
11
star
40

AngularES6HealthApp

The Angular Health App implemented with ECMAScript 6 and Babel.js
JavaScript
11
star
41

wasm-trees

An example of memory management/passing buffers between WebAssembly and JavaScript
C
10
star
42

Ng2TypeScriptLab

A hands-on lab for building your first AngularJS 2.0 apps with TypeScript.
9
star
43

git-fork-branch-cheatsheet

My cheat sheet for the git/fork/branch workflow
9
star
44

BlazorDebounce

Example of an easy way to debounce input without timers.
HTML
9
star
45

tic-tac-toe-ng2

Tic-Tac-Toe with Computer Opponent written in Angular 2 and TypeScript
TypeScript
9
star
46

ng2ts-workshop

Angular 2 with TypeScript day workshop
TypeScript
9
star
47

PlasmaWasmGo

Implementation of Plasma effect in WebAssembly using Go
JavaScript
8
star
48

Angular2ReduxKendoUIHealthApp

An Angular 2 app using Redux and the Kendo UI Angular 2 controls.
TypeScript
8
star
49

micro-locator

Simple services locator.
TypeScript
8
star
50

build-event-grid

Event Grid publisher and consumer example
C#
8
star
51

intro-to-typescript

Introduction to TypeScript for JavaScript developers
CSS
7
star
52

EFCosmosQuickstart

Mirrors the Azure Cosmos DB quickstart using EF Core 5 and EF Core 6
C#
7
star
53

VanillaJs

An example of using modern JavaScript for framework-free development.
TypeScript
7
star
54

qorlate

Promise correlation for AngularJS
JavaScript
7
star
55

AngularDebuggingAndPerformance

Examples for Angular Debugging and Performance course
JavaScript
6
star
56

SparkMLDocCategorization

Example of automatic categorization using .NET for Spark and ML.NET
C#
6
star
57

StarRepo

A .NET 6.0 ASP.NET Core hosts Blazor WebAssembly app demonstrating client and server GraphQL with HotChocolate.
C#
6
star
58

Event-Grid-Glue

Example Event Grid Application
C#
6
star
59

ng2ts-workshop-v2

Angular and TypeScript workshop initially developed for DevNexus 2017
TypeScript
6
star
60

LearnTypeScript

TypeScript examples
TypeScript
5
star
61

AWSMigration

Migrate from AWS Lambda to Azure Functions
JavaScript
5
star
62

TypeScript2016Prez

Presentation covering thet latest (1.8.x) version of TypeScript with examples and deck.
JavaScript
5
star
63

angular-net

Angular examples using .NET Core.
TypeScript
5
star
64

FoodDatabaseMaui

Food database example
C#
4
star
65

RebuildWinJS

Interactive Windows Store app providing a presentation of what's new with WinJS
HTML
4
star
66

Durable-Registry

A solution for 25 days of serverless to implement a holiday registry using serverless Azure Functions and Durable Functions.
C#
3
star
67

bring-own-app-connect-17

Project example (.NET Core 2.0) for Azure lift and shift talk in Connect() 2017.
C#
3
star
68

WinRTExamples

C#
3
star
69

SomeDb

.NET Conference example EF Core 5.0 app showing simple logging, DebugView, and ToQueryString
C#
3
star
70

TelerikNEXT2015

Deck and Code for TelerikNEXT 2015
CSS
3
star
71

JeremyBookWinJs

A simple example of using WinJS
JavaScript
3
star
72

IQueryableExpressionExamples

Examples for the TDevConf presentation "Inside IQueryable: The Power of .NET Expressions."
C#
3
star
73

Jounce

Jounce, a legacy Silverlight framework based on the MVVM pattern and MEF for dependency injection.
C#
3
star
74

redux6502

6502 Emulator Written in Angular 2 and TypeScript with Redux.
TypeScript
2
star
75

T6502

JavaScript
2
star
76

EFCoreModernDataAccess

EF Core demo application for DEVintersection
C#
2
star
77

jsEventAgg

Lightweight event aggregator (publisher/subscriber) for JavaScript
JavaScript
2
star
78

deepskies

Deep skies navigator BUILD demo.
C#
2
star
79

DurableSearch

Example of using Durable Functions HTTP Task to implement a fan-out/fan-in pattern.
C#
2
star
80

ca-acs

Cloud Academy Azure Container Services Demo Code
JavaScript
2
star
81

awesm-stack

AWESM Stack Deck and Code from Atlanta Code Camp
JavaScript
1
star
82

DotNetDocsBuddy

Your friendly .NET docs assistant.
C#
1
star
83

LearnZoneJs

Learn how to use Zone JS
JavaScript
1
star
84

tsviewmodel

ViewModel implementation in TypeScript using decorators for property change notifications
TypeScript
1
star
85

AngularRoutes

Demonstrates how to use various options for routing in Angular
JavaScript
1
star
86

ZoneJS

Presentation about JavaScript Zones
JavaScript
1
star
87

cdams

CDA Team link shortener
C#
1
star
88

PortableIoC

Portable IOC is a tiny thread-safe Inversion of Control container for Universal Windows Platform apps.
C#
1
star
89

BuildWin8Apps

C#
1
star
90

managing-cloud-data

Demo companion for presentation about managing cloud data
1
star
91

docker-we-rise

Hands-on Docker presentation for the We Rise Women in Technology conference in Atlanta 2017.
HTML
1
star
92

ng2-ts-music-city-code

Angular and TypeScript Development for Music City Code
TypeScript
1
star
93

Ng2TypeScriptPrez

Presentation I gave at the Atlanta .NET User Group about building Angular 2 apps with TypeScript.
JavaScript
1
star
94

Angular2HelloWorld

Simple "Hello, World" app with Angular 2 beta
HTML
1
star