Code
Speed up your API development by converting your API specification into boilerplate code to help you get started. Blackbird currently creates Go projects using templates.
You can also test and debug your APIs against production-like traffic before you promote your code to production, allowing you to inspect and troubleshoot in real-time.
Note: You must install Docker to use code run and code debug commands with Blackbird. For more information, see Get Docker.
Generate code
Use a sample template to generate code
First, download the sample petstore.yaml file to use for testing.
Then, run the code generate command:
Finally, the CLI prompts you for variables. Provide the package version and package name.
When the simple API project is generated, it creates a new directory with all the necessary modules and go
files for the projects, including the Dockerfile you'll use to run and debug the code.
Use an existing API in Blackbird to generate code
To generate code using an existing API in the Blackbird catalog, pass the name of the API as an argument. For information on creating a new API in the catalog, see API Design Generation with Blackbird.
Build and run a local container with a remote server
To start debugging an API or mock, pass in the instance name as well as the path to the dockerfile and context.
Build and debug a local container with a remote server
This command is similar to the run
command, but it attaches a debugger to the container.
Secure a code instance
By default, the remote code instance server endpoints are available publicly. To secure these endpoints, you can use API keys. You can also create and set an API key on creation with the --apikey-header
flag. The following templates show the valid ways to enable an API key for code instance servers.