A minimal URL shortening service.
- gorilla/mux for routing.
- urfave/negroni for middleware.
- go-redis/redis for caching.
docker build -t moetify:latest .
Deploy redis and moetify.
kubectl apply -f k8s/redis-deployment.yml
kubectl apply -f k8s/moetify-deployment.yml
Create a redis service.
kubectl apply -f redis-service.yml
Create a moetify service of type LoadBalancer.
kubectl expose deployment moetify-app --name moetify-lb-service \
--type LoadBalancer --port 80 --target-port 8080
Create a tiny url.
curl -X POST http://moetify.vim.moe/api/shorten -d '{
"url": "http://example.com/",
"expiration_in_minutes": 5
}'
Get more tiny url information.
curl -X GET 'http://moetify.vim.moe/api/info?shortlink=B22ul6TZwiRl'
http://moetify.vim.moe/B33spMi94CO4 will be redirected to http://example.com/.