tklein1801 / URL-Shortener

Golang URL shortener w/ CLI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang URL shortener

Server

Getting started

Note

In order to run this application, you need to have a working Redis instance running.

  1. Clone the repository
  2. Set all required environment variables (as defined in .env.example)
  3. Start your application
    go run main.go
  4. Open your browser and go to http://localhost:3000/

API

Get the list of short URLs

GET /list

curl http://localhost:3000/list?code=<AUTH_CODE>

Create a new short URL

POST /shorten

curl -X POST http://localhost:3000/shorten \
    -d 'url=https://www.google.com'

Get a short URL

GET /r/:shortUrl

curl http://localhost:3000/r/:shortUrl?code=<AUTH_CODE>

Delete a short URL

DELETE /d/:shortUrl

curl -X DELETE http://localhost:3000/d/:shortUrl

CLI

About

Golang URL shortener w/ CLI


Languages

Language:Go 98.3%Language:Dockerfile 1.7%