GitXplorerGitXplorer
y

URL-Shortener

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
281e97b25cafc9bc54388d2fa555a8d43cdc29bf

Update README.md

yyarspirin committed 5 years ago
Unverified
f2138174bd634a77928fec90f5ead16ddf19307c

Update README.md

yyarspirin committed 5 years ago
Unverified
87a2d4f00db5e1804cf98a026b57863e8cf69038

Update README.md

yyarspirin committed 5 years ago
Unverified
ee6c4880445502f64b633d1da1cdb0c690130ef6

Update README.md

yyarspirin committed 5 years ago
Unverified
e7c36427a97ce33172a411d1cb6f1fc3e3178c9d

Update README.md

yyarspirin committed 5 years ago
Unverified
a803bd5e5b707c51cd26e7e0525205983893921c

Update README.md

yyarspirin committed 5 years ago

README

The README file for this repository.

URL-Shortener

This service provides short aliases redirecting to long URLs.

URL shortening is used to create shorter aliases for long URLs. We call these shortened aliases “short links.” Users are redirected to the original URL when they hit these short links. Short links save a lot of space when displayed, printed, messaged, or tweeted. Additionally, users are less likely to mistype shorter URLs.

High-level Design and Architecture

The app consists of two parts: frontend and backend. The frontend of the app is written in ReactJS and backed by a number of React components.The backend is written in Go with support of the Gin framework that is used to route requests.

Frontend

The app is built by following the concept of SPA. Thus, it doesn't need to reload the page during its use and works within a browser. The button and the text field on the page are brought by the Material-UI: A popular React UI framework. It provides nice animations and state validation out of the box.

Once the input is validated, a request to the internal API is initiated. The response from the backend is used to update the page by populating it with a short url and original url.

Backend

The backend API contains two methods:

  • api/shorten: the HTTP POST method that takes a JSON like {"url": "<URL>"} and responds with a JSON of kind {"url": "<URL>", "key": "<KEY>"}. The key parameter in the response body is used to map the original url and later can be used by the next API methed.
  • /<KEY>: the HTTP GET method that, given with the key, redirects to the original page.

Deployment

For the deployment purposes the app is contained in a Docker image.