Skip to content

pupubird/serverless-link-shortener

Repository files navigation

Project logo

*Icons made by Freepik from www.flaticon.com*

Serverless Link Shortener

Status GitHub Issues GitHub Pull Requests


A serverless link shortener hosted on AWS.

📝 Table of Contents

🧐 About

This serverless application is a typical link shortener, but hosted serverlessly.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

What things you need to install this serverless application.

  1. An AWS account.
  2. AWS user account with programmatic access.

Installing

Install serverless cli globally by

npm install -g serverless

Don't forget to configure your aws as well! You may need to download aws cli here

For more information, please go to the official https://www.serverless.com/framework/docs/getting-started/

🧰 Usage

There are only 2 endpoints:

GET - https://<your_url>/{name}:

  • A get request with name as the path parameters, example be like: https://8onb6olqak.execute-api.us-east-1.amazonaws.com/prod/amazon. It will redirect you to the actual url behind this shorterned link.

POST - https://<your_url>/:

  • A post request with the following field:
    • name: The name of the shorterned url
    • url: The actual url that will be redirected to

Example:

$> curl -d '{"name":"<your preferred short name>", "url": "<the actual url>"}' -X POST -H "Content-Type: application/json" <the api gateway url >

It should return your short name in response:

<your preferred short name>

🚀 Deployment

This project had been setup completely with serverless, to deploy, simply run:

serverless deploy

You should be seeing an API gateway spun up with similar url like https://8onb6olqak.execute-api.us-east-1.amazonaws.com/prod/

⛏️ Built Using

If you have any cool feature in mind, do not hesitate to open up a GitHub issue! I will be very happy to continue with this project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published