https://github.com/poboisvert/go_shortener
Golang using Fiver V2 and Postgres SQL to redirect an internal url to an external
https://github.com/poboisvert/go_shortener
go golang postgres redirect sql url url-shortener
Last synced: 2 months ago
JSON representation
Golang using Fiver V2 and Postgres SQL to redirect an internal url to an external
- Host: GitHub
- URL: https://github.com/poboisvert/go_shortener
- Owner: poboisvert
- Created: 2022-10-05T01:52:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-17T01:05:51.000Z (over 3 years ago)
- Last Synced: 2025-08-25T06:47:22.546Z (10 months ago)
- Topics: go, golang, postgres, redirect, sql, url, url-shortener
- Language: Go
- Homepage: https://repository-images.githubusercontent.com/89461145/cd557500-21d2-11ea-8886-7030d5aaaf93
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GO_shortener
## Requirements
- Docker
- Go
- Vs Code
## Running the App
```bash
git clone https://github.com/poboisvert/GO_shortener.git
```
```bash
cd GO_shortener
```
### Database SQL
```bash
cd server && docker-compose up
```
- Make sure the SQL server is running on PORT 3000
### API
```bash
go mod tidy
```
```bash
go run main.go
```
## How it works
- model
- goly.go
- contain the structure of the query to link go and postgres SQL under Gorm
- model.go
- store the schema to communicate with the DB
- server
- crud.go
- contain all functions to link to an unique route
- server.go
- contain all routes to perform an event
- utils
- random.go
- generate a random value
## Postman
url: localhost:5000/url
Method: POST
Body: RAW with JSON format
```bash
{
"url_text": "",
"redirect": "https://mega.io/",
"random": true
}
```