Skip to content

This article will teach you how to create a CRUD RESTful API in a Golang environment that runs on a Gin Gonic server and uses a PostgreSQL database. We’ll also discuss how you can build models, connect to the running SQL database server, and run database migrations with the GORM library.

Notifications You must be signed in to change notification settings

khalidtouch/golang-gorm-postgres

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to Setup Golang GORM RESTful API Project with Postgres

This article will guide you on how you can set up a Golang project with the GORM library and PostgreSQL to build CRUD RESTful API to perform the basic Create/Get/Update/Delete operations

How to Setup Golang GORM RESTful API Project with Postgres

Topics Covered

  • What is an ORM?
  • Setup the Golang Project
    • Initialize the Golang Project
    • Create a PostgreSQL Docker Container
    • Load and Validate the Environment Variables
    • Create a Utility Function to Connect to PostgreSQL
  • Data Modeling and Migration with GORM
    • Creating the Database Model with GORM
    • Install the UUID OSSP Module for PostgreSQL
    • Migrating the Schema with GORM
  • Create the Golang Server with Gin Gonic
  • Testing the Golang API

Read the entire article here: https://codevoweb.com/setup-golang-gorm-restful-api-project-with-postgres

Articles in this series:

1. How to Setup Golang GORM RESTful API Project with Postgres

How to Setup Golang GORM RESTful API Project with Postgres

2. API with Golang + GORM + PostgreSQL: Access & Refresh Tokens

API with Golang + GORM + PostgreSQL: Access & Refresh Tokens

3. Golang and GORM - User Registration and Email Verification

Golang and GORM - User Registration and Email Verification

4. Forgot/Reset Passwords in Golang with SMTP HTML Email

Forgot/Reset Passwords in Golang with SMTP HTML Email

5. Build a RESTful CRUD API with Golang

Build a RESTful CRUD API with Golang

About

This article will teach you how to create a CRUD RESTful API in a Golang environment that runs on a Gin Gonic server and uses a PostgreSQL database. We’ll also discuss how you can build models, connect to the running SQL database server, and run database migrations with the GORM library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%