An open API service indexing awesome lists of open source software.

https://github.com/genesisblock3301/url_shortner_golang

This is golang based url shortend api
https://github.com/genesisblock3301/url_shortner_golang

Last synced: about 1 year ago
JSON representation

This is golang based url shortend api

Awesome Lists containing this project

README

          

# URL shortener #

URL shortener is a third-party website that converts that long URL to a short, case-sensitive alphanumeric code..

## Installation ##

URLshortener is compatible with modern Go releases in module mode, with Go installed:
Install all package by using `go get `
```bash "github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"log"
"net/http"
"go.mongodb.org/mongo-driver/bson"
"hash/fnv"
"net/url"
"os"
```

### Project Layout

```tree
├── config
│   ├── db
│   │   └── database-config.go
| | └── loader.go
│   ├── helper
│   │   └── GetDB.go
├── controllers
│   └── urls.go
├── logger
│   └── log.go
├── model
│   └── url.go
├── router
│   └── route-router.go
├── main.go
├── .gitignore
├── README.md
```
## Run project:
```bash
go run main.go
```

## End points ##

```bash
localhost:8000/create/
```
Request body
```json
{
"longUrl": "https://github.com/GenesisBlock3301/full_featured_golang_app"
}
```
Redirect to target url using short url
```bash
localhost:8000/
```

## Learning Scope ##
1. Url shortener.
2. how to work 301 & 302 url redirect work.
3. Base64
4. How to work hash

## License ##

This library is distributed under the BSD-style license found in the [LICENSE](./LICENSE)
file.