https://github.com/squidmin/go-rest
https://github.com/squidmin/go-rest
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/squidmin/go-rest
- Owner: squidmin
- Created: 2023-12-06T02:44:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-06T02:45:29.000Z (over 2 years ago)
- Last Synced: 2025-02-07T13:54:18.655Z (over 1 year ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-rest
Reference repo for a REST API service written in Go. Demonstrates a basic setup using the Gin framework.
## Prerequisites
Before you begin, ensure you have the following installed:
- Go (v1.15 or later)
- Git
>To check the version of Go installed, run the `go version` command:
## Installation
To set up the project on your local machine, follow these steps:
### Install Dependencies
The project uses Go Modules for managing dependencies. To install all the necessary dependencies, run:
```shell
go mod tidy
```
This command will download and install all the required packages.
## Run the application
To run the application, navigate to the `/cmd/api` directory and use the `go run` command:
```shell
cd cmd/api
go run main.go
```
The server should start, and you will see a message indicating that it's listening on a port (default is `:8080`).
## Testing the API
Once the server is running, you can test the API endpoints. For example, to test the `/ping` endpoint:
```shell
curl http://localhost:8080/ping
```
You should see a response like:
```json
{"message":"pong"}
```