Enable rest resource resource when module installs I have a custom rest resource I have created within my module:

/**
 * Provides a Demo Resource
 *
 * @RestResource(
 *   id = "custom",
 *   label = @Translation("custom"),
 *   uri_paths = {
 *     "canonical" = "/rest/custom"
 *   }
 * )
 */
class custom extends ResourceBase {
public function get() {
    return new ResourceResponse("Response");
}


I have a rest.resource.custom.yml file in my module/custom/install folder to activate the end point when the module gets installed but it doesnt work:

id: module.custom
plugin_id: 'custom'
granularity: method
status: true
configuration:
  GET:
    supported_formats:
      - json
    supported_auth:
      - cookie


How do you enable rest endpoints when module is installed?
The error was in the .yml file with the id: attribute. Dont need to include the module name with it:

id: custom
plugin_id: 'custom'
granularity: method
status: true
configuration:
  GET:
    supported_formats:
      - json
    supported_auth:
      - cookie