Skip to content

janfess/go-REST-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go REST API

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.

Features

  • 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 .http files for rapid testing via IDE.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/janfess/go-REST-API.git
    cd go-REST-API
  2. Install dependencies:

    go mod download
  3. Run the application:

    go run .

    The server will start on http://localhost:8080.

API Endpoints

Public Endpoints

  • POST /signup - Register a new user
  • POST /login - Authenticate a user and receive a JWT token
  • GET /events - List all events
  • GET /events/:id - Get details of a specific event

Protected Endpoints (Requires JWT)

  • POST /events - Create a new event
  • PUT /events/:id - Update an existing event
  • DELETE /events/:id - Delete an event
  • POST /events/:id/register - Register for an event
  • DELETE /events/:id/register - Cancel registration for an event

License

Distributed under the MIT License. See LICENSE for more information.

About

A clean, professional Go REST API reference implementation using Gin, JWT authentication, and SQLite. Built with backend best practices and modular architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages