go-url-shortener
A URL-SHORTENER API that uses Golang and MongoDB and works similarly like bit.ly .
A REST API url-shortener made in Golang.
Requirements
- GOLANG
- POSTMAN
- MONGO COMPASS GUI
You can run it locally and online:
Locally
$ git clone https://github.com/edwinnduti/go-url-shortener.git
$ cd go-url-shortener
$ go install
$ export MONGOURI=mongodb://localhost:27017
$ sudo service mongod start
$ go run main.go
Available locally:
function |
path |
method |
Create shorturl |
/ |
POST |
Get single url |
/{id} |
GET |
Get redirected |
/{urlid} |
GET |
Delete single url |
/{id} |
DELETE |
update single user |
/{id} |
UPDATE |
Get longurl |
/expand |
GET |
Online
$ curl -X POST -H "Content-Type:application/json" -d {"longurl": "<enter longurl e.g https://google.com/search?=Skygardener>"} https://localhost:8045/
Have Fun!