System Information
- Strapi Version: 3.1.4
- Operating System: MACOS Big Sur
- Database: MongoDB
- Node Version: v12.17.0
- NPM Version: 6.14.4
- Yarn Version: 1.22.5
Hi Everyone,
I am certain the following question is super easy to answer.
We have created a content type “address_unit”. Strapi generated the folders /api/address-unit
I am busy writing a custom controller but unable to access the “address_unit” service as per below (Cannot read property ‘create’ of undefined):
entity = await strapi.services.address_unit.create(dataAddress);
If I console.log the strapi.services object I get the following result:
'address-unit': {
find: [Function: find],
findOne: [Function: findOne],
count: [Function: count],
create: [Function: create],
update: [Function: update],
delete: [Function: delete],
search: [Function: search],
countSearch: [Function: countSearch],
__filename__: 'address-unit.js'
},
}
Obviously, I cannot write:
entity = await strapi.services.address-unit.create(dataAddress);
or
entity = await strapi.services.'address-unit'.create(dataAddress);
What should I do in this case?