How to use sync gateway with pouch db in web application

How to use sync gateway with pouch db in web application, please help.

This helped me:
http://blog.couchbase.com/first-steps-with-pouchdb--sync-gateway-todomvc-todolite

Especially the CORS part, which I haven’t figured out in the first place.