Git Product home page Git Product logo

shortened-url's Introduction

shortened-url

A simple implementation of shortened url in Java, Spring Boot, Postgres and Redis.

Use

After cloning the project go to the root of the project and run:

./gradlew bootRun

The gradle will download the dependencies and start the application.

API

To generate a short url we should use the following instructions.

Endpoint:

POST /shortened-url/url

Request:

{
    "originalUrl":"http://my-long-url",
    "alias": "my-alias",
    "timeToExpiration": 1636213524
}

The fields alias and timeToExpiration are optionals.

Response: 201

{
    "domainApp": "http://localhost:8080/shortened-url",
    "alias": "65066c97-d9e5-485f-b772-0f02e2a22171",
    "shortUrl": "http://localhost:8080/shortened-url/65066c97-d9e5-485f-b772-0f02e2a22171"
}

Getting the existent short url:

Endpoint:

GET /shortened-url/url/{alias}

localhost:8080/shortened-url/url/GnYZH3O0

Response: 302

Redirect to the orignal url.

Redis

Consulting key in Redis:

127.0.0.1:6379> keys *
1) "\xac\xed\x00\x05t\x00\x03URL"

Load Test

I am using Locust https://locust.io/ as a tool for loading test.

It is a tool make in Python that is very easy to use.

The script are into the folder named load-test, so go to there and run locust, after that, locust will start an application server to run the tests.

shortened-url's People

Contributors

monteirocicero avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.