A REST API in Golang to showcase DB access, insert, update and delete.
The API is modeled based on the guidelines in the below link:
Building Golang with Echo, echo framework
The two third-party packages used are:
- echo, HTTP web server
- go-sqlite3, database driver handlers
Package execution:
1) Download the zip from Github link.
2) Install go package.
3) Run "go get github.com/chinmoy21/ciscorestapi
4) Move to "$GOPATH/github.com/chinmoy21/ciscorestapi"
5) Run "go build main.go"
6) On the web browser, run "http://localhost:1200/"
The available endpoints are:
-
HOME
- GET
/to print readme
- GET
-
People
- GET
/people/to list all the people entries - GET
/people/:idto show a particular people entry - POST
/people/to create a people entry - PUT
/people/:idto update a people entry - DELETE
/people/:idto remove a people entry
- GET
-
Vehicles
- GET
/vehicles/to list all the vehicles entries - GET
/vehicles/:idto show a particular vehicles entry
- GET
-
Starships
- GET
/starships/to list all the starships entries - GET
/starships/:idto show a particular starships entry
- GET