1414 * limitations under the License.
1515 */
1616
17- const featureProbe = require ( '../dist/featureprobe-server-sdk-node.min ' ) ;
17+ const featureProbe = require ( '../dist/index.js ' ) ;
1818const pino = require ( 'pino' ) ;
1919
2020const user = new featureProbe . FPUser ( ) . with ( 'userId' , '00001' ) ;
@@ -40,29 +40,30 @@ const FEATURE_PROBE_SERVER_URL = 'https://featureprobe.io/server'; // for featu
4040const FEATURE_PROBE_SERVER_SDK_KEY = 'server-9b8b98cf444328ff1280a0757b26ec0abdacba76' ; // change me
4141
4242const fpClient = new featureProbe . FeatureProbe ( {
43- remoteUrl : FEATURE_PROBE_SERVER_URL ,
44- serverSdkKey : FEATURE_PROBE_SERVER_SDK_KEY ,
45- refreshInterval : 5000 ,
46- // logTransport: pino(logToFile) // uncomment this line to try out pino transport, by default a general pino client will be used
43+ remoteUrl : FEATURE_PROBE_SERVER_URL ,
44+ serverSdkKey : FEATURE_PROBE_SERVER_SDK_KEY ,
45+ refreshInterval : 5000 ,
46+ // logTransport: pino(logToFile) // uncomment this line to try out pino transport, by default a general pino client will be used
4747} ) ;
4848
4949const main = async ( ) => {
50- // wait until the repo has been initialized
51- // await fpClient.start();
52- // add time limit
53- await fpClient . start ( 1000 ) ;
54- console . log ( 'FeatureProbe evaluation boolean type toggle result is:' , fpClient . booleanValue ( 'campaign_allow_list' , user , false ) ) ;
55- console . log ( 'FeatureProbe evaluation boolean type toggle detail is:' , fpClient . booleanDetail ( 'campaign_allow_list' , user , false ) ) ;
56- console . log ( ) ;
57- console . log ( 'FeatureProbe evaluation string type toggle result is:' , fpClient . stringValue ( 'string_toggle_key' , user , 'default' ) ) ;
58- console . log ( 'FeatureProbe evaluation string type toggle detail is:' , fpClient . stringDetail ( 'string_toggle_key' , user , 'default' ) ) ;
59- console . log ( ) ;
60- console . log ( 'FeatureProbe evaluation number type toggle result is:' , fpClient . numberValue ( 'promotion_campaign' , user2 , 0 ) ) ;
61- console . log ( 'FeatureProbe evaluation number type toggle detail is:' , fpClient . numberDetail ( 'promotion_campaign' , user2 , 0 ) ) ;
62- console . log ( ) ;
63- console . log ( 'FeatureProbe evaluation json type toggle result is:' , fpClient . jsonValue ( 'json_toggle_key' , user , { } ) ) ;
64- console . log ( 'FeatureProbe evaluation json type toggle detail is:' , fpClient . jsonDetail ( 'json_toggle_key' , user , { } ) ) ;
65- await fpClient . close ( ) ;
50+ // wait until the repo has been initialized
51+ // await fpClient.start();
52+ // add time limit
53+ await fpClient . start ( 1000 ) ;
54+ console . log ( 'FeatureProbe evaluation boolean type toggle result is:' , fpClient . booleanValue ( 'campaign_allow_list' , user , false ) ) ;
55+ console . log ( 'FeatureProbe evaluation boolean type toggle detail is:' , fpClient . booleanDetail ( 'campaign_allow_list' , user , false ) ) ;
56+ console . log ( ) ;
57+ console . log ( 'FeatureProbe evaluation string type toggle result is:' , fpClient . stringValue ( 'string_toggle_key' , user , 'default' ) ) ;
58+ console . log ( 'FeatureProbe evaluation string type toggle detail is:' , fpClient . stringDetail ( 'string_toggle_key' , user , 'default' ) ) ;
59+ console . log ( ) ;
60+ console . log ( 'FeatureProbe evaluation number type toggle result is:' , fpClient . numberValue ( 'promotion_campaign' , user2 , 0 ) ) ;
61+ console . log ( 'FeatureProbe evaluation number type toggle detail is:' , fpClient . numberDetail ( 'promotion_campaign' , user2 , 0 ) ) ;
62+ console . log ( ) ;
63+ console . log ( 'FeatureProbe evaluation json type toggle result is:' , fpClient . jsonValue ( 'json_toggle_key' , user , { } ) ) ;
64+ console . log ( 'FeatureProbe evaluation json type toggle detail is:' , fpClient . jsonDetail ( 'json_toggle_key' , user , { } ) ) ;
65+
66+ await fpClient . close ( ) ;
6667} ;
6768
6869main ( ) . then ( ( ) => console . log ( 'Enjoy using FeatureProbe!' ) ) ;
0 commit comments