mehmethalis / gin-gorm-api-basic

Sample gin api with Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

Run the following command to install packages and dependencies

go mod tidy

Create .env file in root directory:

DB_HOST=localhost
DB_USER=user
DB_PASSWORD=password
DB_NAME=test
DB_PORT=5432
JWT_SECRET=secret

Endpoints


Auth

Route HTTP Verb Body Description
/api/auth/login POST {'email': 'email@email.com', 'password':'*****'} Validate credentials
/api/auht/register POST {'name':'foo', 'email': 'email@email.com', 'password':'*****'} Create a new user

User

Route HTTP Verb Body Header Description
/api/user/profile PUT {'name': 'john' , email': 'email@email.com', 'password':'*****'} { 'Authorization' : 'Token'} Validate credentials
/api/user/profile GET {'name':'foo', 'email': 'email@email.com', 'password':'*****'} Create a new user

About

Sample gin api with Golang


Languages

Language:Go 100.0%