Skip to content

An open-source URL shortener micro-service (REST). Created using MongoDB, ExpressJS, NodeJS and Typescript. Can be deployed using docker or serverless architecture.

License

Notifications You must be signed in to change notification settings

prma85/url-shortener-microservice

Repository files navigation

URL Shortener - API

Service responsible for the URL shortener

Setup

Local Setup

Rest API

POST / (Create)

create a new URL based on originalUrl

Request

{
  "full": "https://www.yoursite.com/your-path/your-page"
}

Response

{
  "status": true,
  "data": {
    "uuid": "0b354e7c-3d7a-4a42-94ea-135e7d20cd7d",
    "short": "hRYzMtjx",
    "full": "https://www.yoursite.com/your-path/your-page",
    "createdAt": "2020-07-30T21:37:16.321Z",
    "clicks": 0
  }
}

GET /{CODE} (Open URL)

Open the originalUrl based on code

Request

GET http://localhost:3000/hRYzMtjx

Response

It redirects to the originalUrl

Deploy

This service is using AWS lambda with the serveless Caludia

Configure your AWS access credentials

To accomplish this you need to:

  • Create an AWS profile with IAM full access, Lambda full access and API Gateway Administrator privileges.
  • Add the keys to your .aws/credentials file:
  [default]
  aws_access_key_id = YOUR_ACCESS_KEY
  aws_secret_access_key = YOUR_ACCESS_SECRET

About

An open-source URL shortener micro-service (REST). Created using MongoDB, ExpressJS, NodeJS and Typescript. Can be deployed using docker or serverless architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published