Git Product home page Git Product logo

go-short's Introduction

README

Abstract

go-short a simple URL shortner.

Pre-requisites

# install dependencies
dep ensure

Development (local)

# start redis server with persistent storage
docker run --rm --name redis -p 6379:6379 -v $(pwd)/data:/data -d redis:latest redis-server --appendonly yes

# start dev server
go run *.go

Deploy demo (heroku)

# assuming you already have all the heroku-cli setup
# see: https://devcenter.heroku.com/articles/getting-started-with-go#introduction

# create free redis instance (data not persisted)
heroku addons:create heroku-redis:hobby-dev

# this creates a redis instance and expose it's config in the REDIS_URL environment variable
heroku config

# (optional) needs to be done only once, if you want a custom domain name
heroku domains:add go.stang.sh

# deploy (for next times)
git push heroku master

# (debug) connect to the redis server
heroku redis:cli

Technical implementation

The APIs are wrote in Go, and the data is stored in redis. The frontend is a static page that is bundled and served by the binary.

TODO

  • add logging
  • add tests
  • add documentation
  • validate URL format
  • handle key colisions
  • add basic stats

go-short's People

Contributors

stang avatar

Watchers

 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.