A simple short URL generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
CismonX b0887dde0d
archive
5 years ago
gradle/wrapper archive 5 years ago
src/main archive 5 years ago
.gitignore archive 5 years ago
LICENSE archive 5 years ago
README.md archive 5 years ago
build.gradle archive 5 years ago
gradlew archive 5 years ago
gradlew.bat archive 5 years ago

README.md

url-shortener

A simple short URL generator, written in kotlin.

1. API

1.1 Create new URL

POST /manage

Create a new short URL. Accepts content-type application/x-www-form-urlencoded.

Body should contain one parameter, url, the desired URL to be shortened.

Returns application/json, format:

{
    "err" : 0,
    "data" : {
        "id" : "<Long>: ID of short URL",
        "uuid" : "<String>: 22 character unique string"
    }
}

This API requires authentication.

1.2 Get all URL

GET /manage

Return a list of all URLs you've created.

Returns application/json, format:

{
    "err" : 0,
    "data" : [
        {
            "id" : "<Long>: ID of short URL",
            "uuid" : "<String>: 22 character unique string",
            "url" : "<String>: The exact URL to be redirected to"
        },
        {
            "..." : "..."
        },
        "..."
    ]
}

This API requires authentication.

1.3 Delete URL

DELETE /manage/{id}

Delete a URL with the given ID.

This API requires authentication.

1.4 Using short URL

GET /{uuid}

If the given UUID is valid, server will return a 302 Found, and your browser will redirect you to the corresponding real URL.

Otherwise you'll get a 404 Not Found.

2. Authentication

Managing short URLs requires authentication.

Simply specify x-auth-id and x-auth-token in HTTP header.

You should manually add users in the auth table.

3. Build

This project provides a Gradle wrapper, so it's easy to build.

Be sure to configure your MySQL database and edit the application.properties file before running.