Giter Club home page Giter Club logo

urlhda's Introduction

urlhda

Solution for URL shortening: nginx, postgres, json.
Includes: website, android application, and simple bash script for url shortening.
Live example: hda.me

## Requirements

Configuration examples location and installation

  • conf folder includes nginx.conf section example, site-enabled/sitename (vhost) example, sql file to import and debian rules file example useful for package rebuild.
  • script folder includes shortening bash script example.
  • website folder includes main url shortener website page example
  • android_app folder includes example android application, where apk file is actual application used for hda.me url shortener website.

Once you have nginx and the needed modules installed you can start nginx up with the the configuration in this found in /conf and /website folders.

You also need to setup a database in your PostgreSQL-server and create separate table, don't forget set password. Use the /config/database.sql file to do it for you. After you are done adjust the settings to your environment in the nginx configuration.
Example:
Creating user and database:

CREATE USER "user" WITH PASSWORD 'password';  
CREATE DATABASE databasename WITH OWNER "user";  

Importing:

psql -h localhost -d databasename -U user -f database.sql

##Usage

  1. Script
    Edit host, chmod 755, and copy to /usr/local/bin/ Usage: urlhda http[s]://your_long_url_here
  2. Website
    Install, configure, edit index.html to change appearance for your needs and your done.
  3. Android app
    Change host in index.html, import to android studio, sign apk with your personal key and finally build apk.

How it works

You can shorten URLs with a POST-request:

  curl -X POST https://website.name/add?url=http://add.me

This will give you JSON-response back with the generated 5 character UID:

[{"uid":"abcd5"}]

With that you can go to for example to https://website.name/abcd5 and you will be redirected to http://add.me

##Other Original idea: Sebastian Gräßl, forked from https://github.com/bastilian/sebas
Bitcoin donate: 1N5czHaoSLukFSTq2ZJujaWGjkmBxv2dT9

urlhda's People

Contributors

bastilian avatar sweetlion avatar

Watchers

James Cloos avatar Udo Kifferbrehl 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.