Skip to content

gunavault/Go-Gin-Postgres-template

Repository files navigation

GO GIN POSTGRES API Template GitHub license

This is a GO GIN POSTGRES API Template built with Go and the Gin framework. It allows user registration, login, and access to user information with JWT-based authentication. you can custom this API as you need. I'll update this template little by little when I have a chance.

Features

  • User registration with password hashing
  • User login with JWT token generation
  • Example of Basic Crud
  • JWT-based authentication middleware
  • Testing API with get User

Setup

  1. Clone the repository:
    git clone https://github.com/gunavault/Go-Gin-Postgres-template.git
    cd Go-Gin-Postgres-template
  2. Install Dependency:
    go mod tidy
  3. Copy .env.example and make adjustment on your .env
  4. Create a PostgreSQL database and Ensure the required uuid-ossp extension is enabled for UUID generation.
  5. run the query from query.sql
  6. run the code :
    go run main.go
    

Endpoints

  • POST/login
  • POST/register
  • GET/users
  • GET/user/username

You can find more the endpoint at thunderclient collection thunder-collection_Go Gin postgres API template.json

License

MIT licensed.

Releases

No releases published

Packages

No packages published

Languages