Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shuienko/goshort
Custom URL Scheme Shortener API
https://github.com/shuienko/goshort
Last synced: 29 days ago
JSON representation
Custom URL Scheme Shortener API
- Host: GitHub
- URL: https://github.com/shuienko/goshort
- Owner: shuienko
- Created: 2018-03-30T12:11:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-02T11:15:14.000Z (over 6 years ago)
- Last Synced: 2023-12-09T22:31:55.027Z (11 months ago)
- Language: Go
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# goshort
## Description
*goshort* is URL Shortener that supports custom URL Schemes.
See API description below.
## Build
- Install `dep` https://github.com/golang/dep#installation
- Get dependencies
```bash
dep ensure
```
- Build binary
```bash
go build -o goshort
```## Usage
```
Usage of goshort:
-dbbucket bucket
DB bucket name (default "goshort")
-dbpath string
Path to the database file (default "goshort.db")
-listen string
Listen interface (default "127.0.0.1:8080")
-salt string
Hash salt string (default "tFZ2cQ7U8OQlSWOyZIoFdRusvkFvJh3A")
-scheme string
URL scheme http or https (default "http")
```## API
Request body format: `{ "url": "http://exmple.com" }`
### Operations
| Endpoint | Method | Description |
| ---------- | -------- | -------------------------------------------------------------- |
| /{id} | GET | Will redirect you to the corresponding Long URL with 301 code. |
| /v1/short | POST | Will return short URL in the response body. |### Examples
#### Short request
```
$ curl -d'{"url":"https://google.com"}' -XPOST http://s.shov.cloud/v1/short
{"shortURL":"http://s.shov.cloud/xqJW9dZ"}
```#### Redirect
```
$ curl http://s.shov.cloud/xqJW9dZ
Moved Permanently.
```