I've been a fan of FWT but now I'm exploring Domkit. I've been looking at the testDomkit examples, which are pretty nice, BTW. However, I haven't been able to figure out how to exchange data between the Domkit frontend and a Java backend service using the standard HTTP methods GET, POST, PUT, DELETE, etc. The backend service returns data in JSON format. I've written Fantom code before but have never run it on the browser (never used @Js annotation before). I found that web::WebClient is not available in the Javascript VM. Can someone point me to a basic example showing how to request data from a Domkit UI and how to submit Domkit form data to the backend, please?
SlimerDudeTue 17 Sep 2019
Hi LightDye, welcome back!
Very briefly, you can use dom::HttpReq to make HTTP calls from within a (domkit fuelled) browser.
LightDyeWed 18 Sep 2019
Hi LightDye, welcome back!
Thank you! I always keep an eye on Fantom. I'm not fortunate enough to get paid for programming in Fantom, but it is still my preferred programming language.
Related to this, it'd be great to get afJson working in the browser so JSON from the server can be mapped to front-end Fantom domain objects... but tickets 2768 and 2770 would need to be fixed first.
LightDyeWed 18 Sep 2019
Hi SlimerDude, you answered my next question before I even asked. Thank you. I'll do some workaround until you can release a @Js version of afJson after tickets 2768 and 2770 get fixed.
LightDye Tue 17 Sep 2019
I've been a fan of FWT but now I'm exploring Domkit. I've been looking at the testDomkit examples, which are pretty nice, BTW. However, I haven't been able to figure out how to exchange data between the Domkit frontend and a Java backend service using the standard HTTP methods GET, POST, PUT, DELETE, etc. The backend service returns data in JSON format. I've written Fantom code before but have never run it on the browser (never used @Js annotation before). I found that web::WebClient is not available in the Javascript VM. Can someone point me to a basic example showing how to request data from a Domkit UI and how to submit Domkit form data to the backend, please?
SlimerDude Tue 17 Sep 2019
Hi
LightDye
, welcome back!Very briefly, you can use dom::HttpReq to make HTTP calls from within a (domkit fuelled) browser.
LightDye Wed 18 Sep 2019
Thank you! I always keep an eye on Fantom. I'm not fortunate enough to get paid for programming in Fantom, but it is still my preferred programming language.
This worked perfectly. Thank you.
SlimerDude Wed 18 Sep 2019
Related to this, it'd be great to get afJson working in the browser so JSON from the server can be mapped to front-end Fantom domain objects... but tickets 2768 and 2770 would need to be fixed first.
LightDye Wed 18 Sep 2019
Hi SlimerDude, you answered my next question before I even asked. Thank you. I'll do some workaround until you can release a @Js version of afJson after tickets 2768 and 2770 get fixed.