From 1b4a9a1dbcbd9c8281ec1252792de9e2c32e25cd Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 30 Oct 2017 01:37:23 +0100 Subject: [PATCH] fixed typos, cleaned up --- .travis.yml | 2 +- README.md | 34 +++++++++++++++++----------------- coverage.sh | 52 ---------------------------------------------------- 3 files changed, 18 insertions(+), 70 deletions(-) delete mode 100644 coverage.sh diff --git a/.travis.yml b/.travis.yml index d4ff673..15dc969 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ before_install: - go get github.com/mattn/goveralls script: - go test -v ./... - - $GOPATH/bin/goveralls -service=travis-ci \ No newline at end of file + - goveralls -service=travis-ci \ No newline at end of file diff --git a/README.md b/README.md index 0757d0b..68dc73b 100644 --- a/README.md +++ b/README.md @@ -9,42 +9,42 @@ - URL Shortening - Visitor Counting -- Deletion URLs +- URL deletion - Authorization System -- High Performance database with [bolt](https://github.com/boltdb/bolt) -- ShareX integration +- High performance database with [bolt](https://github.com/boltdb/bolt) +- [ShareX](https://github.com/ShareX/ShareX) integration - Easy Docker Deployment ## Server Installation ### Standard -Since we don't provide prebuild binaries, you have to build it yourself. For that you need golang and git installed on your system. +Since we don't provide prebuild binaries, you have to build it yourself. For that you need Golang and Git installed on your system. ```bash git clone https://github.com/maxibanki/golang-url-shortener # Clone repository -cd golang-url-shortener # Go into it -go get -v ./... # Fetch dependencies -go build # Build executable -./golang-url-shortener # Run it +cd golang-url-shortener # Go into it +go get -v ./... # Fetch dependencies +go build # Build executable +./golang-url-shortener # Run it ``` ### Docker Compose -- Only execute the [docker-compose.yml](docker-compose.yml) and adjust the enviroment variables to your needs. +Only execute the [docker-compose.yml](docker-compose.yml) and adjust the environment variables to your needs. ### Envirment Variables: -| Envirment Variable | Description | Default Value | +| Environment Variable | Description | Default Value | | ------------------ | ----------- | ------------- | | SHORTENER_DB_PATH | Relative or absolute path to the bolt DB | main.db | -| SHORTENER_LISTEN_ADDR | Adress to which the http server should listen to | :8080 | +| SHORTENER_LISTEN_ADDR | Address to which the http server should listen to | :8080 | | SHORTENER_ID_LENGTH | Length of the random short URL id | 4 | ## Clients: ### [ShareX](https://github.com/ShareX/ShareX) Configuration -This URL Shortener has fully support with ShareX. To use it, just import the configuration to your ShareX. For that you need to open the `Destination settings` => `Other / Custom uploaders` => `Import` => `From Clipboard`. +This URL Shortener has fully support with ShareX. To use it, just import the configuration to your ShareX. For that you need to open the `Destination settings` => `Other / Custom uploaders` => `Import` => `From Clipboard` menu. After you've done this, you need to set it as your standard URL Shortener. For that go back into your main menu => `Destinations` => `URL Shortener` => `Custom URL Shortener`. @@ -68,27 +68,27 @@ After you've done this, you need to set it as your standard URL Shortener. For t #### `/api/v1/create` POST -Create is the handler for creatng entries, you need to provide only an URL. The responsive will always be JSON encoded and contain an URL with the short link. +Create is the handler for creating entries, you need to provide only an URL. The response will always be JSON encoded and contain an URL with the short link. -There is a mechamism integrated, that you can call this endpoint with the following techniques: +There is a mechanism integrated, that you can call this endpoint with the following techniques: - application/json - application/x-www-form-urlencoded - multipart/form-data In all cases only add the long URL as a field with the key `URL` and you will get the response with the short URL. -### `/api/v1/info` POST +#### `/api/v1/info` POST This handler returns the information about an entry. This includes: - Created At - Last Visit -- Visit count +- Visitor counter To use this, POST a JSON with the field `id` to the endpoint. It will return a JSON with the data. ## TODO -- Authentification +- Authorization - Deletion - Add Curl Examples - Test docker-compose installation diff --git a/coverage.sh b/coverage.sh deleted file mode 100644 index 0eb28f8..0000000 --- a/coverage.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# Generate test coverage statistics for Go packages. -# -# Works around the fact that `go test -coverprofile` currently does not work -# with multiple packages, see https://code.google.com/p/go/issues/detail?id=6909 -# -# Usage: script/coverage [--html|--coveralls] -# -# --html Additionally create HTML report and open it in browser -# --coveralls Push coverage statistics to coveralls.io -# - -set -e - -workdir=.cover -profile="$workdir/cover.out" -mode=count - -generate_cover_data() { - rm -rf "$workdir" - mkdir "$workdir" - - for pkg in "$@"; do - f="$workdir/$(echo $pkg | tr / -).cover" - go test -covermode="$mode" -coverprofile="$f" "$pkg" - done - - echo "mode: $mode" >"$profile" - grep -h -v "^mode:" "$workdir"/*.cover >>"$profile" -} - -show_cover_report() { - go tool cover -${1}="$profile" -} - -push_to_coveralls() { - echo "Pushing coverage statistics to coveralls.io" - goveralls -coverprofile="$profile" -repotoken lhWzILT1WMRgrHXsEhauQOGsoby1nm7DR -} - -generate_cover_data $(go list ./...) -show_cover_report func -case "$1" in -"") - ;; ---html) - show_cover_report html ;; ---coveralls) - push_to_coveralls ;; -*) - echo >&2 "error: invalid option: $1"; exit 1 ;; -esac \ No newline at end of file