Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 1.66 KB

README.md

File metadata and controls

59 lines (37 loc) · 1.66 KB

shorturl

Try it out

Demo site: https://l.xjj.pub

Or you may wanna offer me a nicer and shorter domain 🙃.

Deploy on your own host

Apparently deploying by docker is suggested, so make sure you have docker n your host before everything.

  • Clone this repo
git clone [email protected]:Mivinci/shorturl.git
cd shorturl
  • Build the docker image
docker build -t shorturl .
  • Run the image
docker run --rm -d -p 5000:8080 shorturl

Surely, you can change 5000 to any other port you'd like to deploy on for this project.

  • Use Caddy for reverse proxy (Optional)

Make sure you have installed Caddy on your host.

  1. Create a Caddyfile in the root directory of the repo and write the following content in it.
xxx.com {
    reverse_proxy localhost:5000
}

You need to change xxx.com to your own domain name.

  1. Run the following commands to activate the Caddyfile you just wrote and reload Caddy.
caddy adapt
caddy reload

Besides, Caddy will automatically generate certificate files for your site, so you can visit it by https after using Caddy.

About this repo

I didn't use go mod, also known as go module to manage this project, because I wanted to keep the root directory clean. It doesn't actually bother me not to use go mod for such a small project. Also, I'd like to regard this project as a minimal implementation for a URL shortening service, so only the most needed functionalities were coded.