The code you are seeing in the example IS with fees! the variable called
minerFee is the fee that you are paying and it is a fixed amount of 0.0001
BTC.
Just change that line to anything you like, it can be a fixed amount or it can be a function taking the best amount of fee based on an API call such as this
http://bitcoinfees.21.co/apiOr if you are doing it on top of a full node you can analyze the previous blocks to figure out the suitable fee.