A web API boilerplate for Gin.
-
Build the image.
docker build -t myapp .
-
Start a container of the newly built image.
docker run --rm -p 8000:8000 my-go-api
-
Run the app.
go run .
-
Navigate to
localhost:8000
-
Request the data from the
/
(Home) endpoint. This endpoint is public to anyone and does not require a JWT token to be sent in the Header of the request.curl --location --request GET "http://localhost:8000" | jq
-
Get the data from the
api/v1/pokemon
endpoint. This endpoint is private and can only be accessed with a valid JWT token sent in the Header of the request. Replace<REPLACE_WITH_YOUR_ACCESS_TOKEN>
with your access token, which can be created for testing the workflow atAuth0 > Applications > APIs > Test > CURL
.curl --location \ --request GET "http://localhost:8000/" \ --header "Authorization: Bearer <REPLACE_WITH_YOUR_ACCESS_TOKEN>" | jq
- jwt.io
- Auth0 docs