Choreo Sample REST API - Reading List
Use the following configuration when creating this component in Choreo:
- Build Preset: Dockerfile
- Dockerfile Path:
go/rest-api/Dockerfile
- Docker Context Path:
go/rest-api
The endpoints.yaml file contains the endpoint configurations that are used by the Choreo to expose the service.
Run the service locally
go run main.go
Generate API definitions
Generated using Go annotations https://github.com/swaggo/swag
-
Download swag CLI tool by running:
go install github.com/swaggo/swag/cmd/swag@v1.8.11
-
Run the following command to generate the API definitions:
swag fmt && swag init
Service Configurations (optional)
Refer config.go file for the available configurations.
For more information on how to configure a service in Choreo, refer Manage Configurations and Secrets documentation.
Load initial data ( optional )
- Set environment variable by navigating to Choreo Deploy page
INIT_DATA_PATH=configs/initial_data.json
- Mount the file contents of
configs/initial_data.json
in the path specified in step 1.
See initial_data.json for a sample file.