This is Dcard's homework about implementing url shortener. This repository includes all the modules with the mono-repo architecture. Also, if you want to know more about this homework detail, you can refer to this spec.
The following are the packages used in this Golang project.
- gin-gonic: as framework
- go-pg: to connect Postgres DB and store url information.
- go-redis: to enhance the performance of redirecting url request.
- go-migrate: to create db table.
- google-uuid: to create a new uuid as a shorten url.
- golang/mock, ginkgo and gomega: to do the unit test
- golangci: to check the style
Before starting this program, please make sure that your docker is running.
This project has unit tests with ginkgo framework for DAO and toolkit in pkg directory.
- Test whole project
make dc.test
- Test pkg
make dc.pkg.test
This project uses golangci to check the style.
- Check whole project's style
make dc.lint
- Check only modules' style
make dc.internal.lint
- Check only pkg's style
make dc.pkg.lint
- Build shorten url api image
make dc.image
- This time, I only use google-uuid to simply generate shorten url. The next goal is to adopt a suitable shorten url algorithm.
- This implementation is kind of like image-to-url converter. So I want to extend this project to contain image-to-url converter in the future.