Skip to content

Sample product api implemented in Go with the Gin Framework that has an embedded sqlite database.

Notifications You must be signed in to change notification settings

sup-mule/go-product-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product API Service

Description

A sample product API service that uses an embedded sqlite database implemented in Go and containerized.

Prerequisites

  • Docker
  • K8s cli (For K8s deployment)

Building

The project can be built as a docker container with the following command:

docker build -t go-product-api:latest .

Running locally

The built container can be run locally as follows:

docker run -p 8080:8080 go-product-api:latest

Deploying to k8s

First step is to build and push the container to a container registry that can be accessed from a K8s cluster.

Under the K8s directory there is a sample deployment and service files. The deployment definition needs the path to the container image published from above step. It can be installed using the following sample commands. Note that the example puts all the data in an emptyDir mount which means all the data is reset if the application is restarted.

  • kubectl create ns cc-demo
  • kubectl create -f k8s/deployment.yaml
  • kubectl create -f k8s/service.yaml

Open API Spec

The open api spec for the API is available here

About

Sample product api implemented in Go with the Gin Framework that has an embedded sqlite database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages