It depend of what types of fish you have- feeding veg can add variety to a fishs diet, and because its fresh its often quite healthy. When it comes to feeding fish foods like this, don't feed veg/fruit that has a high sugar or citric acid content (like oranges, lemons, apples, bananas etc), as the majority of fish don't have stomaches that can cope with this kind of stuff and it can cause digestive issues.
Spinache, cucumber, tomatoes, zuchini, lettuce and peas etc are quite safe and healthy for most fish- these sorts of veg are often fed to fish that are herbivores/have a liking for algae or plant matter or are general omnivores or insectivores, like plecs, oto's and many other catfish out there, many of the common livebearers like mollys and guppys etc...Peas are often fed to fish that have constipation as the fibre can help get rid of it, most fish will take peas when it comes down to it. Some fish will take some types of veg easier than others, like although most bettas will take cooked peas, they won't take to cucumber very easily (pretty much show no interest in it).
A varied diet is often the key to a healthy fish, i often think fish flakes are over sold as a general fish food, but most small fish will generally prefer foods like bloodworms, daphinia, tubifex, krill and other similar foods much more- the only issue with these foods is that they are very high in protein, so making sure they don't get overfed on these foods and that they get enough veg of some sort in there diet is important.
Fish flakes, although good as a general purpose food for a lot of fish out there, can also cause constipation when fed too much like other dried foods can, veg as often is the case is the best way of sorting this out though- cooked (and somtimes chopped) peas are quite a popular veg choice for this situation.
As i said before though, it depends on what type of fish you have. For example plecs like common and sailfin plecs need a lot of veg in their diet, for the most part they get this from algae, but as they age they tend to go off algae eating- feeding them algae wafers and veg is very important for them throughout their lives, also with the addition of things like high protein foods every now and then like prawns, tropical fish meat, squid, mussels etc as it can be hard for them to get all the protein their need to grow from veg alone.
Danios and bettas really thrive though on little critters like daphinia, tubifex, krill and bloodworms with the addition of a little veg etc...Simply put, attending to the particular type of fishs diet needs you have is the best way to go to having healthy fish
.