Skip to content

nfo94/event-booking-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

event-booking-api-go

Simple API in Go using Gin and SQLite. To run this project clone it in your machine and run:

go mod tidy

And then run:

go run main.go

This will make the API available locally in http://localhost:8080/. If you wish to debug this app in VSCode you can use the Debugger with the configuration in .vscode. Hit cmd/ctrl+shift+D and click on play "Launch package".

Example for creating a user:

curl -X POST http://localhost:8080/signup \
-H "Content-Type: application/json" \
-d '{
  "email": "test1@gmail.com",
  "password": "totally-not-safe"
}'

Example login:

curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{
  "email": "test1@gmail.com",
  "password": "totally-not-safe"
}'

Grab the JWT token and use for protected routes. Example POST request for creating an event:

curl -X POST http://localhost:8080/events \
-H "Content-Type: application/json" \
-H "Authorization: token \
-d '{
  "Name": "Devops na Praia fev/2025",
  "Description": "Encontro de devops no Porto.",
  "Location": "Porto, PT",
  "DateTime": "2025-02-15T09:00:00Z"
}'

Example GET request to check all created events:

curl -X GET http://localhost:8080/events

Example DELETE request to delete an event:

curl -X DELETE http://localhost:8080/events/2

Example POST request to register for an event:

curl -X POST http://localhost:8080/events/1/register \
-H "Content-Type: application/json" \
-H "Authorization: token

Example DELETE request to cancel a registration for an event:

curl -X DELETE http://localhost:8080/events/1/register \
-H "Content-Type: application/json" \
-H "Authorization: token

About

Event booking API written with Go, Gin, and SQLite.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages