Update api.md

Add example of supporting both promises and node-style callbacks.