This Project is used to create the short url from given url.
- Flat File Based Database
- API for create short URL
- API for get short URL information.
- Redirect short url into original url.
go get github.com/belekarpavan/urlshortnerGo to the project directory. i.e workspace/src/github.com/belekarpavan/urlshortner/
go run main.goThis API is used to create the short url from given url.
Request body : {"url":"Your url"}
URL : http://localhost:8000/o/create
Request body : { "url" : "https://github.com/belekarpavan/urlshortner"}
Response : {
"alias": "ZjVmYWE3ZT",
"originalURL": "https://github.com/belekarpavan/urlshortner",
"createdOn": "2021-08-11T09:38:04.5839015+05:30",
"shortURL": "http://localhost:8000/ZjVmYWE3ZT"
}
This API is used to get the short url details.
Request body : {"url":"Your short URL"}
URL : http://localhost:8000/o/get
Request body : { "url" : "http://localhost:8000/ZjVmYWE3ZT"}
Response : {
"alias": "ZjVmYWE3ZT",
"originalURL": "https://github.com/belekarpavan/urlshortner",
"createdOn": "2021-08-11T09:38:04.5839015+05:30",
"shortURL": "http://localhost:8000/ZjVmYWE3ZT"
}
This API is used to redirect the orginal URL.
URL : http://localhost:8000/ZjVmYWE3ZT
It redirected to the https://github.com/belekarpavan/urlshortner URL.

