This article introduces how to quick start the Apache ShenYu
gateway in the standalone environment.
download apache-shenyu-incubating-2.4.2-bootstrap-bin.tar.gz
unzip apache-shenyu-incubating-2.4.2-bootstrap-bin.tar.gz
。 go to the bin
directory.
> windwos : start.bat > linux : ./start.sh
please refer to Developer Local Model add the selector and rule.
example:
http://127.0.0.1:8080/helloworld
and the response like follow:{ "name" : "Shenyu", "data" : "hello world" }
POST
method,addresshttp://localhost:9195/shenyu/plugin/selectorAndRules
,body useraw json
content:
{ "pluginName": "divide", "selectorHandler": "[{\"upstreamUrl\":\"127.0.0.1:8080\"}]", "conditionDataList": [{ "paramType": "uri", "operator": "match", "paramValue": "/**" }], "ruleDataList": [{ "ruleHandler": "{\"loadBalance\":\"random\"}", "conditionDataList": [{ "paramType": "uri", "operator": "match", "paramValue": "/**" }] }] }
curl --location --request POST 'http://localhost:9195/shenyu/plugin/selectorAndRules' \ --header 'Content-Type: application/json' \ --data-raw '{ "pluginName": "divide", "selectorHandler": "[{\"upstreamUrl\":\"127.0.0.1:8080\"}]", "conditionDataList": [{ "paramType": "uri", "operator": "match", "paramValue": "/**" }], "ruleDataList": [{ "ruleHandler": "{\"loadBalance\":\"random\"}", "conditionDataList": [{ "paramType": "uri", "operator": "match", "paramValue": "/**" }] }] }'
http://localhost:9195/helloworld
:{ "name" : "Shenyu", "data" : "hello world" }