简体   繁体   中英

dynamic route for http-request in total.js flow

How to use dynamic url for http-request in total.js flow. I am able to get params from route component but how to pass this to http-request url ?

在此处输入图片说明

It's possible and it's very easy. You can use Code (better) or Repository component.

  • add Code component with this code:
// This will be as dynamic argument stored in hidden Flow Message repository:
repository.code = 'sk';

// or you can bind value from received data:
repository.code = value.code; // value === received data

// Continue with processing
send(0, value);
  • now you can update URL address in HTTP Request component like this:
URL: https://restcountries.eu/rest/v2/alpha/{code}

HTTP Request component will replace {code} for repository.code value. You can use multiple values. That's all :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM