https://github.com/srvariable/sapigo
Simple API in Go
https://github.com/srvariable/sapigo
Last synced: 12 months ago
JSON representation
Simple API in Go
- Host: GitHub
- URL: https://github.com/srvariable/sapigo
- Owner: SrVariable
- Created: 2025-03-19T10:11:42.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-19T16:03:37.000Z (about 1 year ago)
- Last Synced: 2025-03-19T17:22:37.373Z (about 1 year ago)
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sapigo - A Simple API for testing Go and Gin
Simple API built with Go and Gin. This project serves as a test case for learning how to use the [Gin Web Framework](https://gin-gonic.com/).
# API Endpoints
|Method|Endpoint|Description|
|-|-|-|
|`GET`|`/v1/students`|Get all students|
|`GET`|`/v1/students/:id`|Get student by ID|
# Installation
Clone the repository
```
git clone https://github.com/SrVariable/sapigo
```
Navigate to the project folder
```
cd sapigo
```
Install dependencies
```
go mod tidy
```
# Usage
Run the program
```
go run ./cmd/sapigo
```
Alternatively, you can build an executable and run it
```
go build ./cmd/sapigo
./sapigo
```
Once it's running, you can interact with the API using your browser, curl, or any method you prefer.
- To get a list of every student:
```
curl localhost:8080/v1/students
```
- To get the student by ID:
```
curl localhost:8080/v1/students/1
```
Check [API Endpoints](#api-endpoints) to see available endpoints.
# References
- https://go.dev/doc/tutorial/web-service-gin
- https://youtu.be/67yGbvyM1is
- https://gin-gonic.com/docs
- https://github.com/gin-gonic/examples/tree/master/group-routes