Simple REST Api that exposes CRUD endpoints to work with a Person
resource. This project is made for the HNGx stage 2 task
- GOlang
- Gorm
- Gorilla Mux
- SQlite
- Create new person
- Get single person using person id in path param
- Update single person using person id in path param
- Delete single person using person id in path param
To run this on your machine, ensure you have go installed, if click here to install it.
Once you've setup Go, clone the repo
git clone https://github.com/bytedeveloperr/hngx-stage-2-task.git
and download the project's packages
go mod download
Use the command below to start the api server
go run .
A struct that represent an individual person. It has two fields name
and id
. name
is of type string while id
is either a string or integer.
GET /api
returns list of all available usersPOST /api
creates a new user with thename
passed in the request bodyGET /api/:userid
returns the user with theuserid
in the request paramPUT /api/:userid
updates the user with theuserid
in the request paramDELETE /api/:userid
deletes the user with theuserid
in the request param