A simple url shortener using Base62 conversion.
- Go 1.16+
- docker-compose 1.27.0+
- Works without JavaScript ☑️
- Dark mode 🌒
- Single binary (
go:embed
)
$ ./bin/go-url-shortener -help
Usage of ./bin/go-url-shortener:
-port string
server port (default "4000")
-public string
public url prefix (default "http://localhost:4000/")
# Create .env file
$ make -B .env env=local
# Download go modules
$ go mod download
# Start linked services (postgres, etc.)
$ make deps
# Apply database migrations
$ ./scripts/migrate.sh up
# Run in watch mode (restart on file change)
$ make dev
# Or run in normal mode
$ go run ./cmd/go-url-shortener/
$ make test
$ make -B .env env=docker
$ ./scripts/migrate.sh up
$ docker-compose up app
migrate - CLI and Golang library.
$ ./scripts/migrate.sh up
$ ./scripts/migrate.sh down
$ ./scripts/migrate.sh create -dir /migrations -ext sql -seq create_new_table
Output:
migrations/XXXXXX_create_new_table.up.sql
migrations/XXXXXX_create_new_table.down.sql