From 23f9d7a1e0c57ba5e797d285eaf8be8b82d34452 Mon Sep 17 00:00:00 2001 From: Jason Hilder Date: Sat, 25 Apr 2026 19:39:05 +0200 Subject: [PATCH] Makefile for quick and dirty testing. --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..972e06c --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +# Variables +HOST=http://localhost:3333 +COOKIE_FILE=cookies.txt + +run: + go run cmd/main.go + +# 1. Register a user +register: + curl -v POST $(HOST)/register \ + -d "email=jason@debian.org" \ + -d "password=pass123" + +# 2. Login and SAVE the cookie to a file +login: + curl -v POST $(HOST)/login \ + -d "email=jason@debian.org" \ + -d "password=pass123" \ + -c $(COOKIE_FILE) + +# 3. Access a protected route using the saved cookie +test-auth: + curl GET $(HOST)/users \ + -b $(COOKIE_FILE) + +# 4. Cleanup +clean-cookies: + rm -f $(COOKIE_FILE) + +.PHONY: run register login test-auth clean-cookies