spring-cloud-samples / spring-cloud-gateway-sample

Sample Spring Cloud Gateway Application
Apache License 2.0
360 stars 235 forks source link

Spring cloud gateway sample as a mock service #19

Closed vforvikash closed 3 years ago

vforvikash commented 3 years ago

Hello, @spencergibb

I have developed some code around Spring Cloud Gateway to allow gateway to act as a proxy to a service or provide mock data based on mock configuration.

I want to submit the same as a sample for gateway. Please let me know how can i do the same. Below are some details:

Is your feature request related to a problem? Please describe. Needed a mock service based on proxy capability. The required mock service must be able to intercept incoming requests and return mock response if configured or forwards to existing live service.

Describe the solution you'd like I have developed a framework on top of Spring Cloud Gateway to enable mock configuration based on properties/config service. This framework allows to add mock configuration for a given API endpoint. This mock API either produces mock response or proxies the requests to live the service. The mock can be turned on/off for a given endpoint. It can also help to simulate difficult cases like timeouts for outbound calls by adding delays to mock response. Also, the mock configuration is property based which doesn’t require any modification.

Describe alternatives you've considered There are few json-server which can be quickly configured and started. But it does not have a proxy capability.

image

Thanks & Regards, Vikash

spencergibb commented 3 years ago

I'd say put it in your own repo

vforvikash commented 3 years ago

Thanks for your quick response @spencergibb. Is there any plan on adding other sample project in the future? is there a process to contribute like sample-gateway-oauth2login?

spencergibb commented 3 years ago

This org is for samples of features that are core to spring cloud and not for 3rd party extensions.

vforvikash commented 2 years ago

This org is for samples of features that are core to spring cloud and not for 3rd party extensions.

Thanks for your input @spencergibb. I have added the sample here https://github.com/ExpressScripts/sample-gateway-mock-apis. Just adding for reference.

spencergibb commented 2 years ago

Yes. I looked thru it very nice. I even reopened the feature request in gateway

vforvikash commented 2 years ago

Wow 🤩 Thanks a ton to check the sample.