What is the way to cook vegetables that keeps most of the nutrients?
It depends upon the vegetable in question, the nutrients one desires to obtain from it, and the digestive capacity of the person (or, if you're considering cooking for your pets or livestock, animal) eating the result.
Take carrots, for instance. As this article discusses, "boiling and steaming better preserves antioxidants, particularly carotenoids, in carrots, than frying, though boiling was deemed the best." Also, "cooking carrots increases their level of beta-carotene." Yet, "The downside of cooking vegetables is that it can destroy some of the vitamin C in them. The reason is that Vitamin C, which is highly unstable, is easily degraded through oxidation, exposure to heat (it can increase the rate at which vitamin C reacts with oxygen in the air) and through cooking in water (it dissolves in water)."