Skip to content

Latest commit

 

History

History
98 lines (86 loc) · 4.12 KB

README.md

File metadata and controls

98 lines (86 loc) · 4.12 KB

UrlShortener

GitHub top language GitHub language count PRs Welcome GitHub release GitHub Release Date GitHub license

Overview

UrlShortener is a quick, open-source project for shortening URL, you can easily host your own URL shortener service with it, similar to TinyURL.com and 百度短网址, plus basic statistics over the data.

Features

  • Development based on Spring Boot and Redis.
  • Support for building docker image by a maven plugin named dockerfile-maven-plugin.
  • Support for configuring blacklist for long URL via domains.
  • Providing REST APIs for shortening a URL and get the original URL.
  • Providing extended REST APIs for data statistics, such as the most top N visited short URLs.

Quick Start

The minimum requirements to run the quick start are:

  • JDK 1.8 or above
  • Git
  • Maven 3.5.3 or above
  • Redis server
  • Docker Engine
  • A Java IDE like IntelliJ IDEA (optional)
  1. Clone
    $ git clone https://github.com/rupertw/url-shortener.git
    $ cd url-shortener
  2. Modifiy application.properties, blacklist
    #默认8080端口
    #server.port=80
    
    #域名
    url.shortener.service.host=http://www.me
    
    #SnowFlake
    snowflake.datacenterId=1
    snowflake.machineId=1
    
    #Redis
    spring.redis.host=localhost
    spring.redis.port=6379
    spring.redis.password=todo
    spring.redis.database=1
    ...
    
    #xxx.com
    yyy.com
    
  3. Build an image from the Dockerfile
    $ mvn -DskipTests clean package -U
    $ mvn dockerfile:build
  4. Create a container layer over the new image, and then start it
    $ docker run -p 80:8080 rupertw/url-shortener:1.0.0.RELEASE
  5. Test the REST APIs
    http://127.0.0.1/swagger-ui.html
    

Documents

Releases

References

License

UrlShortener is released under the MIT License.