Skip to content

Easy to follow boilerplate for a Golang web server with JWT authentication

License

Notifications You must be signed in to change notification settings

Sharizzle/go-sql-auth-template-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoLang Gorm, SQL, Gorm, Mux, JWT Auth REST API Boilerplate

Easy to follow boilerplate for a Golang webserver with authentication.

Packages Used

  • Mux (Routing)
  • Crypto (Hashig passwords)
  • Gorm (Go ORM)
  • JWT GO (Authentication)
  • SQL Lite Drivers

Routes

Basic CRUD Routes for User Data

  • Show Users GET /users
  • Create User POST /users
  • Show User GET /users/{userId}
  • Delete User DELETE /users/{userId}
  • Update User PUT /users/{userId}
  • User Login POST /users/login

Configuration

Create a .env file with the following parameters. For SQL Lite only port and JWT secret are required.

PORT = ...
ENVIRONMENT = ...
DB_HOST = ...
DB_NAME = ...
DB_USERNAME = ...
DB_PASSWORD = ...
JWT_SECRET = ...

Installation

Run the command to install all dependancies.

go mod download

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Easy to follow boilerplate for a Golang web server with JWT authentication

Topics

Resources

License

Stars

Watchers

Forks

Languages