https://github.com/huseyinbuyukdere/gobasicapi
Basic Go Api Structure
https://github.com/huseyinbuyukdere/gobasicapi
api go sample-project
Last synced: 10 days ago
JSON representation
Basic Go Api Structure
- Host: GitHub
- URL: https://github.com/huseyinbuyukdere/gobasicapi
- Owner: huseyinbuyukdere
- Created: 2020-10-17T11:29:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-18T11:49:40.000Z (over 5 years ago)
- Last Synced: 2026-01-14T14:30:29.480Z (5 months ago)
- Topics: api, go, sample-project
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Basic Go Api Structure

It provides you basic api structure for development.
## Development
You can add your api to pkg/api folder and register api to service in main.go file like below.
If you want authorization by JWT you can set "IsPublic" flag as false but you need to modify login api for verify credentials.
```bash
var routes = []models.Route{
models.Route{HandlerFunction: api.Login, Path: "/login", MethodName: "POST", IsPublic: true},
models.Route{HandlerFunction: api.VerifyTest, Path: "/myNewApi", MethodName: "POST", IsPublic: false},
}
```
It includes logging middleware. Logging middleware is logging all requests to log file which seperated by date.
## Run
You can run the service with the following command.
You need to set your service variables in .env file before run
In cmd folder
```bash
go run main.go
```