The Flex devcenter guides describe a way to perform local testing of your Flex services by running your service locally, and then approaching the API with Postman. This requires the setting of various headers, which can be quite cumbersome. 


This Knowledge Base article describes an alternative method to testing your Flex service locally, using a construct called "External Flex". External Flex allows you to create a Flex service in the console, including hooking it up to your collections, collection hooks, and endpoints, but instead of utilizing our FSR Runtime, "External Flex" points to a URL hosting your Flex service. While officially intended for those customers who are not able to rely on our hosted PaaS layer, it can also serve you well in testing.


To use this, first run your Flex service locally on your development computer, calling "node index.js" to start the service. It will start listening on port 10001:


Now, use the "ngrok" utility (ngrok.io) to expose this localhost:10001 service with a public IP over https. This is called "reverse tunneling". After you run this utility in a different terminal, you will be presented with a https address. This will form the base url for your External Flex service.


Now, log in to the Console, and define an External Flex service:


Discovery of handlers will now work:


Now, you can test your service just by linking your Flex service to a collection, hook or endpoint, and use your mobile application or the API console to test it.



Then you can test the endpoint as if it were a real endpoint as follows.




---