https://github.com/nfo94/event-booking-api-go
Event booking API written with Go, Gin, and SQLite.
https://github.com/nfo94/event-booking-api-go
Last synced: 2 months ago
JSON representation
Event booking API written with Go, Gin, and SQLite.
- Host: GitHub
- URL: https://github.com/nfo94/event-booking-api-go
- Owner: nfo94
- Created: 2025-01-22T10:39:43.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-03-04T19:00:33.000Z (3 months ago)
- Last Synced: 2025-03-04T19:35:12.624Z (3 months ago)
- Language: Go
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### event-booking-api-go
Simple API in Go using Gin and SQLite. To run this project clone it in your machine
and run:```bash
go mod tidy
```And then run:
```bash
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:
```bash
curl -X POST http://localhost:8080/signup \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "totally-not-safe"
}'
```Example login:
```bash
curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "totally-not-safe"
}'
```Grab the JWT token and use for protected routes. Example `POST` request for creating
an event:```bash
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:
```bash
curl -X GET http://localhost:8080/events
```Example `DELETE` request to delete an event:
```bash
curl -X DELETE http://localhost:8080/events/2
```Example `POST` request to register for an event:
```bash
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:
```bash
curl -X DELETE http://localhost:8080/events/1/register \
-H "Content-Type: application/json" \
-H "Authorization: token
```