https://github.com/abhishekb91/petstore-openapi3
Creating HTTP API using golang in openapi3 standard
https://github.com/abhishekb91/petstore-openapi3
echo go golang openapi-codegen openapi3 swagger-ui
Last synced: about 1 month ago
JSON representation
Creating HTTP API using golang in openapi3 standard
- Host: GitHub
- URL: https://github.com/abhishekb91/petstore-openapi3
- Owner: abhishekb91
- License: mit
- Created: 2021-04-04T14:43:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-23T03:57:04.000Z (almost 5 years ago)
- Last Synced: 2024-06-21T18:51:17.371Z (over 1 year ago)
- Topics: echo, go, golang, openapi-codegen, openapi3, swagger-ui
- Language: Go
- Homepage:
- Size: 6.62 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Petstore-Openapi3
Creating HTTP API using golang in openapi3 standard
## Contents
- [Getting started](#getting-started)
- [Development](#development)
## Getting started
The intent of this sample project is to demonstrate the usage of various tools to create webapis using openapi 3 standard. This project uses:
- [oapi-codegen](https://github.com/deepmap/oapi-codegen) to generate server stubs
- [swagger-ui](https://github.com/swagger-api/swagger-ui) to display the api document
- [echo](https://github.com/labstack/echo) as HTTP routing engine
- [statik](https://github.com/rakyll/statik) to compile static files into a Go binary
- [mockery](https://github.com/vektra/mockery) to generate mocks from interfaces
### Prerequisite
- local golang installation
- MySQL Database. Use Makefile to generate MySQL container locally.
## Development
- Starting Application
The service expects database connection to be passed as an environment variable. In order to make local dev easy, there are two options from which one can run the service:
- From Visual Studio Code:
In order to debug the service, one can run the service directly from the Visual Studio Code `Debug and Run` > `Launch` and add breakpoints
- Using Makefile:
From the project Root:
```bash
make start_service
```
- API End-points
```
http://localhost:8080/docs/
```
- Running Unit Tests
```bash
go test ./...
```