Skip to content

rajanarahul93/GoUserAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoUserAPI — Simple Golang REST API with Gorilla Mux & GORM

golang_icon

A simple RESTful API built with Go, Gorilla Mux, GORM, and MySQL for managing user records.

Tech Stack

  • Go 1.23+
  • Gorilla Mux
  • GORM
  • MySQL

Features

  • User CRUD (Create, Read, Update, Delete)
  • Auto database migration
  • REST API endpoints

Setup

Install dependencies:

go mod tidy

In user/ directory:

go mod init user
go mod tidy

In root:

go mod edit -replace user=./user
go mod tidy

MySQL Config

Create a rahuldb database and update DB credentials in user/model.go:

const DbUrl = "root:test123@tcp(127.0.0.1:3306)/rahuldb?charset=utf8mb4&parseTime=True&loc=Local"

Run Project

go build -o go-rest.exe
go-rest.exe

API runs at: http://localhost:8000

API Endpoints

  • GET /users
  • GET /users/{id}
  • POST /users
  • PUT /users/{id}
  • DELETE /users/{id}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages