Move resource fetching into resource.js.