Now that we have confirmed that the service is capturing and parsing the clothing order data correctly, we can add our business logic to the main function.
We next need to create some supportive functions outside of the main function:
fncreate_local_storage(){matchfs::create_dir_all(WORKSPACE_LOCAL_STORAGE){Ok(_)=>{},Err(err)=>{panic!("Warning: Could not create the local directory path {} : {:?}",WORKSPACE_LOCAL_STORAGE,err);},}}
With all the use declarations and supportive functions in place, we can now start modifying the main function.
We first call the function to create the local storage directory when the service starts. This code can be added after the parameters section within the main function.
To add our business logic, (inside the callback function after the println we were using to confirm the service is working correctly) we add the following lines of code:
The final state of your order_clothing.rs file should look like the following: