Skip to content

ngrok-samples/example-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example API in Go

This repo contains a simple Go app that creates an API that reponds with facts about desert tortoises.

There is no database, so changes will not persist between executions.

To start the API:

git clone git@github.com:ngrok-samples/example-api-go.git
cd example-api-go
go run main.go

Usage

Get a single random fact:

curl \
  -X GET \
  http://localhost:5000/random

Get all facts:

curl \
  -X GET \
  http://localhost:5000/facts

Get a specific fact:

curl \
  -X GET \
  https://localhost:5000/fact?id=DT001

Add a new fact:

curl \
  -X POST \ 
  -H "Content-Type: application/json" \
  -d '{"fact": "This is a fact."}' \    
  http://localhost:5000/add

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published