Makefile for quick and dirty testing.

This commit is contained in:
2026-04-25 19:39:05 +02:00
parent 371784af77
commit 23f9d7a1e0
+30
View File
@@ -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