How to get index data into custom visualization?

I have read this similar post, along with this documentation about request handlers. Is there an example someone can point me that shows how to implement a simple request handler?