Factor out an API for the RECAP service into recap.js.