Testing the API
With our specification defined, we can now use mock tools to test it.
Running a Mock Server
Use the popular tool prism to start a mock server from your OpenAPI spec.
npx @stoplight/prism-cli mock openapi.yaml
Once the server is running, you can test it using curl:
curl http://127.0.0.1:4010/hello
You should see the mock response defined in your spec:
{
"message": "Hello World"
}