I am using kong API-gateway in its DB-Less mode
as a result, I have a kong.yaml file as below:
_format_version: "2.1"
_transform: true
services:
- name: service1
url: http://service1:port/sample-path
routes:
- name: service1
methods:
- GET
paths:
- /service1/sample-path
strip_path: true
As you see, the api-gateway dispatches requests from /service1/sample-path
endpoint of api-gatway to http://service1:port/sample-path
I am looking for a way to add a new service such that when a request is sent to /oas
endpoint of api-gateway, it loads a yaml or json file and return that as the response.
In action, I am looking for a way to return a static response instead of dispatching the request?
Any idea how to do this?
pseudo code
_format_version: "2.1"
_transform: true
services:
- name: service1
url: http://service1:port/sample-path
routes:
- name: service1
methods:
- GET
paths:
- /service1/sample-path
strip_path: true
- name: oas
url: STATIC YAML OR JSON FILE
routes:
- name: oas
methods:
- GET
paths:
- /oas
strip_path: true
You can handle that with the plugin https://github.com/IntelliGrape/kong-plugin-static-response