Initialize the resource in the current context: if ctx.resource does not exist, create it with the specified type and bind it; if it already exists, reuse it. You can then access it via ctx.resource.
type: resource type, commonly 'APIResource', 'SingleRecordResource', 'MultiRecordResource', 'SQLResource'.ctx.resource).Difference from makeResource: initResource ensures and may set ctx.resource; makeResource only creates a new instance and does not change ctx.resource.
See detailed APIs for each Resource type: