https://github.com/borischen0203/url-shortener
An URL shortener service. You can generate a short URL and make your alias of short URL.
https://github.com/borischen0203/url-shortener
docker gin gin-gonic github-actions golang heroku-deployment mongodb rest-api swagger
Last synced: 3 months ago
JSON representation
An URL shortener service. You can generate a short URL and make your alias of short URL.
- Host: GitHub
- URL: https://github.com/borischen0203/url-shortener
- Owner: borischen0203
- Created: 2021-06-24T16:11:46.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-19T18:54:35.000Z (almost 4 years ago)
- Last Synced: 2023-03-10T11:41:17.530Z (over 3 years ago)
- Topics: docker, gin, gin-gonic, github-actions, golang, heroku-deployment, mongodb, rest-api, swagger
- Language: Go
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

[](https://github.com/borischen0203/URL-shortener/actions/workflows/CICD.yml)
# URL-shortener service
This is a URL shortener service. You can generate a short URL by a long URL.
Moreover, you can make your alias of short URL.
## Features
- Generate short URL by long URL
- Redirect to long URL by generated URL
- URL generation supports custom alias
## Demo
- No need to run main.go file, you can type the below command in the terminal directly.
- The app may sleep without using. Just wait for a few seconds to wake it up.
```bash
> curl -X POST -H "Content-Type: application/json" -d '{"longUrl" : "https://www.youtube.com/", "alias":""}' "https://short-url-sample.herokuapp.com/api/url-shortener/v1/url"
```
## Project information and existing API
- `GET` /swagger/*any
- `GET` /health
- `GET` /version
- `GET` /:id
- `POST` /api/url-shortener/v1/url
## How to run in local
### Required
- Golang
- Gin framework >= 1.7
- Docker
- MongoDB
### Run
```bash
> docker pull mongo:3.6
> docker run -p 27017:27017 mongo:3.6
> go run main.go
```
### Demo in local
```bash
> curl -X POST -H "Content-Type: application/json" -d '{"longUrl" : "https://www.youtube.com/", "alias":""}' "http://localhost:8080/api/url-shortener/v1/url"
```
### Tech Stack
- RESTful API
- Swagger
- Gin
- Golang
- MongoDB
- Docker
- Github action(CI)
- Heroku (CD)
### Todo
- [ ] mongoDB add expired time field
- [ ] Add redis for cache
- [ ] MockDB for testing
- [ ] Deploy to AWS