A lightweight and clean REST API built with Go and the Gin framework. This project demonstrates core backend engineering patterns, including JWT-based authentication, custom middleware, and SQLite database integration. It serves as an excellent reference for developers building scalable RESTful services in Go.
- RESTful API Design: Follows standard HTTP methods and resource-based routing.
- Authentication: JWT (JSON Web Token) based authentication for secure endpoints.
- Middleware: Custom request logging and authentication validation.
- Database Integration: SQLite integration with automated table creation on startup.
- Models & Logic: Clean separation of data models and business logic.
- API Testing: Pre-configured
.httpfiles for rapid testing via IDE.
-
Clone the repository:
git clone https://github.com/janfess/go-REST-API.git cd go-REST-API -
Install dependencies:
go mod download
-
Run the application:
go run .The server will start on
http://localhost:8080.
POST /signup- Register a new userPOST /login- Authenticate a user and receive a JWT tokenGET /events- List all eventsGET /events/:id- Get details of a specific event
POST /events- Create a new eventPUT /events/:id- Update an existing eventDELETE /events/:id- Delete an eventPOST /events/:id/register- Register for an eventDELETE /events/:id/register- Cancel registration for an event
Distributed under the MIT License. See LICENSE for more information.