From a blurb for an upcoming public lecture on Bach's cantatas at UC Riverside:
Bach's creative life stretched from the early 1700s till his death in 1750, a time known as the Baroque period in European classical music. Contrary to his somewhat undeserved ultra-religious image, Bach only devoted relatively short periods of this half century to the composition of church music, according to Bach scholar Jan Koster. [emphasis mine] Bach lived in Leipzig, Germany from 1723 until his death in 1750. Bach was a prolific cantata composer, writing more-than 300 cantatas, many in only the first five of years of his time in Leipzig, according to Koster. Many of Bach's cantatas were subsequently lost.