petstore-openapi3

module
v0.0.0-...-b8f4ccc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2021 License: MIT

README

Petstore-Openapi3

Creating HTTP API using golang in openapi3 standard

Contents

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 to generate server stubs
  • swagger-ui to display the api document
  • echo as HTTP routing engine
  • statik to compile static files into a Go binary
  • 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:

      make start_service
      
  • API End-points

    http://localhost:8080/docs/
    
  • Running Unit Tests

    go test ./...
    

Directories

Path Synopsis
src
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL