Coder Social home page Coder Social logo

url-shortener's Introduction

URL Shortener

This is a basic URL shortener where you can create short URL's.

Also supports Slack where you can type slash commands:

Add URLS (Slack)

This adds a short URL.

  • /addcommand shortURL URL

this calls /slack/new

List URLS (Slack)

The main index is protected by a token so that it's not public. To get the token:

  • /listcommand

this calls /slack/list

Runing via xcode

Needs a .env file with the following:

DATABASE_HOST=localhost
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=xxxxxxx
DATABASE_NAME=postgres
ADMIN_TOKEN=xxxxxxxxx
INDEX_TOKEN=xxxxxxxxx
SLACK_SIGNING_SECRET=xxxxxxxxxxxx
SLACK_CLIENT_ID=xxxxxxxx
HOSTNAME=example.link
COMMAND=SLACKCOMMAND

Running via Docker

Alternatively install via docker: https://hub.docker.com/r/jamiewhite/url-shortener

version: '3.7'

volumes:
  db_data:

x-shared_environment: &shared_environment
  LOG_LEVEL: ${LOG_LEVEL:-debug}
  DATABASE_HOST: db
  DATABASE_NAME: postgres
  DATABASE_USERNAME: postgres
  DATABASE_PASSWORD: xxxxxxxx
  ADMIN_TOKEN: xxxxxxxxx
  INDEX_TOKEN: xxxxxxxxxx
  SLACK_SIGNING_SECRET: xxxxxxxxx
  SLACK_CLIENT_ID: xxxxxxx
  HOSTNAME: example.link
  COMMAND: examplelink

services:
  app:
    image: jamiewhite/url-shortener:latest
    environment:
      <<: *shared_environment
    depends_on:
      - db
    ports:
      - '17606:8080'

  db:
    image: postgres:latest
    volumes:
      - db_data:/var/lib/postgresql/data/pgdata
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: xxxxxxxxxxxxxx
      POSTGRES_DB: postgres

url-shortener's People

Contributors

jamiewhite avatar

Watchers

James Cloos 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.