URL Shortener written in Go
Find a file
2024-02-09 19:35:23 +01:00
internal chore: cleanup handle_test 2024-02-09 19:35:23 +01:00
sql fix: return URL if it already exists 2024-01-29 21:37:27 +01:00
.envrc feat: get postgresql URL from env 2024-01-29 21:31:07 +01:00
.gitignore feat: implement retrieve by hash function 2024-01-29 21:31:07 +01:00
atlas.hcl feat: create initial database schema 2024-01-29 21:31:06 +01:00
docker-compose.yaml chore(dev): setup sqlc and atlas 2024-01-29 18:46:59 +01:00
Dockerfile chore: add Dockerfile 2024-01-29 21:32:42 +01:00
flake.lock chore(dev): add flake and .envrc 2024-01-29 18:35:40 +01:00
flake.nix chore(dev): setup sqlc and atlas 2024-01-29 18:46:59 +01:00
gen.go feat: generate OpenAPI server 2024-01-29 21:31:06 +01:00
go.mod feat: implement retrieve by hash function 2024-01-29 21:31:07 +01:00
go.sum feat: implement retrieve by hash function 2024-01-29 21:31:07 +01:00
justfile feat: create initial database schema 2024-01-29 21:31:06 +01:00
main.go chore: cleanup main 2024-02-09 19:29:58 +01:00
openapi.yaml style: format openapi 2024-01-29 22:23:23 +01:00
README.md docs: improve readme 2024-01-29 22:25:40 +01:00
sqlc.yaml chore(dev): setup sqlc and atlas 2024-01-29 18:46:59 +01:00

short

URL Shortener written in Go.

Requirements

Note

If you are using Nix, you can just run nix develop . or direnv allow if you use Direnv.

Dev dependencies

  • ogen to generate OpenAPI server

Running the app

Once you have installed all requirements, you can simply do:

docker compose up -d
just migrate # or atlas migrate apply --env local
go run .

Accessing the docs

The docs is using the openapi.yaml provided in the root directory. A web UI is available at http://localhost:8080/docs. It's using Rapidoc under the hood.

Testing

You can simply test using:

# ensure postgres is up
docker compose up -d
go test ./...

It will create database on the fly for each test.