Skip to content

๐Ÿ“ Custom URL Shortener, using MongoDB and AWS Lambda.

Notifications You must be signed in to change notification settings

rafaeelaudibert/urlShortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

39 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

URL Shortener ๐Ÿ“

Custom URL Shortener, using MongoDB and AWS Lambda.

Usage ๐Ÿ–ฅ๏ธ

  • Create a free MongoDB database (you can use Mongo Atlas M0).
  • Fill the environment variables on .env.sample and copy it to .env file.
  • Deploy the functions to AWS Lambda (or any other lambda provider, if you prefer)
  • Configure your domain manager to point to it

Configuring domain on AWS

Using Route 53 and API Gateway:

  • In Lambdas, select the app you just created (probably with the name url-shortener-prd)
  • In the Resources tab, click on the link to access ApiGatewayRestApi
  • In API Gateway, select "Custom domain names"
  • Create a new domain name in the format you want, for example, url.yourdomain.com. It will create a new domain in the format <id>.execute-api.<your-region>.amazonaws.com
  • On Route53, create a new A type record, pointing to the domain created above

Endpoints โšก

Shorten

Send a POST request to /shorten, with the shortUrl and longUrl parameters on body, and a x-secret headers, which should match the one filled on .env file, if you filled it.

Redirect

Send a GET request to /request/:shortUrl passing the shortUrl, to be redirected to the longUrl.

What is missing?

[ ] Find a way to solve the manual step to configure the domain, using, probably, serverless-domain-manager.

Author ๐Ÿง™โ€โ™‚๏ธ

About

๐Ÿ“ Custom URL Shortener, using MongoDB and AWS Lambda.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published