Skip to content

sebavidal10/api-go-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-go-crud

Example of crud api using go. It has the default methods: GET, POST, PUT and DELETE and use a Event model as example.

How to run

go run cmd/main.go

Endpoints

Get all Events

GET: "/api/events"

Get Event by id

GET: "/api/events/{id}"

Create Event

Need a body with the following structure

{
  "name": "Big Event",
  "description": "a very big event",
  "address": "downtown square"
}
POST: "/api/events"

Update Event

Need a body with the following structure (if some field is not present, it will be set to empty)

{
  "name": "Big Event",
  "description": "a very big event",
  "address": "downtown square"
}
PUT: "/api/events/{id}"

Delete Event

DELETE: "/api/events/{id}"

About

Example of crud api using go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages