this repo has no description

Compare changes

Choose any two refs to compare.

+1
.dockerignore
··· 2 2 *.hurl 3 3 .git/ 4 4 .jj/ 5 + .direnv/
+5
.envrc
··· 1 + use flake 2 + 3 + export BRAINTREE_URL=http://localhost:8001 4 + export STRIPE_URL=http://localhost:8001 5 + export PORT=8000
+1 -1
.gitignore
··· 27 27 28 28 # End of https://www.toptal.com/developers/gitignore/api/go 29 29 30 - *.hurl 30 + .direnv/
+19 -2
README.org
··· 6 6 *** Prerequisites 7 7 8 8 - [[https://hurl.dev][hurl]] :: CLI tool that runs http requests, similar to curl 9 - - [[https://docs.docker.com/desktop/][docker :: ]] Using docker to run project and mocks 9 + - [[https://docs.docker.com/desktop/][docker]] :: Using docker to run project and mocks 10 + - [[https://just.systems/][just]] :: CLI runner 10 11 - [[https://jqlang.org/][jq]] :: (Optional) CLI tool to query JSON data 11 12 13 + If you're using nix, you can find a flake in the root of the project and run =nix develop= to download all the tools (or allow [[https://direnv.net/][direnv]] to auto import in your path) 14 + 12 15 *** Usage 13 16 14 - Run the project with both providers mocked: 17 + Run docker compose to start mocks, the mocks will use ports =8002= and =8003= and the were created using [[https://github.com/mrak/stubby4node][stubby4node]] 15 18 16 19 #+begin_src shell 17 20 docker compose up 18 21 #+end_src 19 22 23 + In another terminal, bulid and run the project with =just=, it will start the project in port =8000= 24 + 25 + #+begin_src shell 26 + just run 27 + #+end_src 28 + 20 29 In other terminal, make the request with hurl 21 30 22 31 #+begin_src shell ··· 28 37 #+begin_src shell 29 38 hurl request.hurl | jq . 30 39 #+end_src 40 + 41 + ** Tests 42 + 43 + To run all tests, you can run the command that it will run all tests from the project: 44 + 45 + #+begin_src shell 46 + just test 47 + #+end_src
+2 -2
cmd/app/main.go
··· 26 26 defer logger.Sync() 27 27 28 28 providers := providers.NewUseProviders([]providers.Provider{ 29 - providers.NewBraintreeProvider("http://"+getEnv("BRAINTREE_URL", "localhost:8001"), logger), 30 - providers.NewStripeProvider("http://"+getEnv("STRIPE_URL", "localhost:8002"), logger), 29 + providers.NewBraintreeProvider(getEnv("BRAINTREE_URL", "http://localhost:8001"), logger), 30 + providers.NewStripeProvider(getEnv("STRIPE_URL", "http://localhost:8002"), logger), 31 31 }, logger) 32 32 paymentsService := service.NewPaymentService(providers) 33 33
-13
docker-compose.yml
··· 1 1 services: 2 - api-gateway: 3 - build: 4 - dockerfile: $PWD/Dockerfile 5 - ports: 6 - - "8000:8000" 7 - environment: 8 - PORT: 8000 9 - BRAINTREE_URL: stripe 10 - STRIPE_URL: braintree 11 - depends_on: 12 - - stripe 13 - - braintree 14 - 15 2 stripe: 16 3 build: 17 4 dockerfile: $PWD/Dockerfile-stubby
+61
flake.lock
··· 1 + { 2 + "nodes": { 3 + "flake-utils": { 4 + "inputs": { 5 + "systems": "systems" 6 + }, 7 + "locked": { 8 + "lastModified": 1731533236, 9 + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 10 + "owner": "numtide", 11 + "repo": "flake-utils", 12 + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 13 + "type": "github" 14 + }, 15 + "original": { 16 + "owner": "numtide", 17 + "repo": "flake-utils", 18 + "type": "github" 19 + } 20 + }, 21 + "nixpkgs": { 22 + "locked": { 23 + "lastModified": 1752012998, 24 + "narHash": "sha256-Q82Ms+FQmgOBkdoSVm+FBpuFoeUAffNerR5yVV7SgT8=", 25 + "owner": "NixOS", 26 + "repo": "nixpkgs", 27 + "rev": "2a2130494ad647f953593c4e84ea4df839fbd68c", 28 + "type": "github" 29 + }, 30 + "original": { 31 + "owner": "NixOS", 32 + "ref": "nixpkgs-unstable", 33 + "repo": "nixpkgs", 34 + "type": "github" 35 + } 36 + }, 37 + "root": { 38 + "inputs": { 39 + "flake-utils": "flake-utils", 40 + "nixpkgs": "nixpkgs" 41 + } 42 + }, 43 + "systems": { 44 + "locked": { 45 + "lastModified": 1681028828, 46 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 47 + "owner": "nix-systems", 48 + "repo": "default", 49 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 50 + "type": "github" 51 + }, 52 + "original": { 53 + "owner": "nix-systems", 54 + "repo": "default", 55 + "type": "github" 56 + } 57 + } 58 + }, 59 + "root": "root", 60 + "version": 7 61 + }
+28
flake.nix
··· 1 + { 2 + description = "A Nix-flake-based Golang development environment"; 3 + 4 + inputs = { 5 + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 6 + 7 + flake-utils.url = "github:numtide/flake-utils"; 8 + }; 9 + 10 + outputs = { self, nixpkgs, flake-utils }: 11 + flake-utils.lib.eachDefaultSystem (system: 12 + let 13 + inherit (pkgs.lib) optional optionals; 14 + 15 + pkgs = import nixpkgs { inherit system; }; 16 + in 17 + { 18 + devShells.default = pkgs.mkShell { 19 + buildInputs = with pkgs; [ 20 + go 21 + hurl 22 + just 23 + jq 24 + ]; 25 + }; 26 + } 27 + ); 28 + }
+1
request.hurl
··· 13 13 "installments": 1 14 14 } 15 15 } 16 + HTTP 200