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
- Host: GitHub
- URL: https://github.com/genesisblock3301/url_shortner_golang
- Owner: GenesisBlock3301
- License: apache-2.0
- Created: 2022-11-29T12:08:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-08T16:52:06.000Z (over 3 years ago)
- Last Synced: 2025-02-26T05:18:59.094Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.