Skip to content

muhajirmuhajir/golang-rest-api-with-gin-and-gorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang REST API with Gin and Gorm

List Person

Request :

  • Method: GET
  • Endpoint: /persons
  • Header :
    • Accept : application/json

Response :

{
  "count": "integer",
  "result": [
    {
      "id": "integer",
      "FirstName": "string",
      "LastName": "string",
      "CreatedAt": "string",
      "UpdatedAt": "string",
      "DeletedAt": "string"
    }
  ]
}

Get Person

Request :

  • Method : GET
  • Endpoint : /person/{id_person}
  • Header :
    • Accept : application/json

Response :

{
  "count": "integer",
  "result": {
    "id": "integer",
    "FirstName": "string",
    "LastName": "string",
    "CreatedAt": "string",
    "UpdatedAt": "string",
    "DeletedAt": "string"
  }
}

Create Person

Request :

  • Method : POST
  • Endpoint : /person
  • Header :
    • Accept : application/json
    • Content-Type : application/json
  • Body :
    • first_name : string
    • last_name : string

Response :

{
  "message": "string",
  "result": {
    "id": "integer",
    "FirstName": "string",
    "LastName": "string",
    "CreatedAt": "string",
    "UpdatedAt": "string",
    "DeletedAt": "string"
  }
}

Update Person

Request :

  • Method : PUT
  • Endpoint : /person/{id_person}
  • Header :
    • Accept : application/json
    • Content-Type : application/json
  • Body :
    • first_name : string
    • last_name : string

Response :

{
  "result": "string",
}

Delete Person

Request :

  • Method : DELETE
  • Endpoint : /person/{id_person}
  • Header :
    • Accept : application/json

Response :

{
  "result": "string",
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages