Skip to content

A sample application demonstrating how to use ConfigCat and OpenFeature in Go

Notifications You must be signed in to change notification settings

configcat-labs/openfeature-go-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Courses App

(Optional) In case the blog post is already published, please add: Read the blog post here

This is a simple app that demonstrates how to use ConfigCat with OpenFeature in Go. The app has a REST API with a single endpoint that returns a predefined list of courses. We can enable or disable the endpoint with a feature flag in ConfigCat.

NOTE: This branch contains the complete code with OpenFeature integrated into the app. Use git checkout starter to switch to the starter branch to see the state of the app before OpenFeature was installed.

Build & Run

Prerequisites

  • A ConfigCat account.
  • Go 1.21.4+.
  • Git
  • A Terminal.
  • A tool to make HTTP requests. Examples: curl, Postman, Thunder Client, e.t.c.
  • Intermediate knowledge of Go and basic knowledge of Git.

Instructions for Running

Follow these steps to run the project on your computer:

  • Open your terminal and clone this repository with this command:

git clone https://github.com/configcat-labs/openfeature-go-sample.git

  • Navigate into the repository's folder:

cd openfeature-go-sample

  • Open main.go and replace "YOUR-SDK-KEY" with your ConfigCat SDK key on this line:

ccProvider := provider.NewProvider(configcat.NewClient("YOUR-SDK-KEY"))

  • Run the app:

go run main.go

  • Visit http://localhost:8000/courses
  • Toggle the feature flag in your ConfigCat dashboard to enable and disable the endpoint.

Learn more

Useful links to technical resources.

ConfigCat also supports many other frameworks and languages. Check out the full list of supported SDKs here.

You can also explore other code samples for various languages, frameworks, and topics here in the ConfigCat labs on GitHub.

Keep up with ConfigCat on Twitter, Facebook, LinkedIn, and GitHub.

Author

Zayyad Muhammad Sani

Contributions

Contributions are welcome!

About

A sample application demonstrating how to use ConfigCat and OpenFeature in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages