I am attempting to create a singleType collection for plugin settings as I can’t get the settings page to work. I’ve used yarn strapi generate
I’m getting this error, which indicates that the setting contentType is not being imported properly and therefore doesnt know what singleType means afaik
TypeError: Error creating endpoint GET /notifications/setting: Cannot ││ read properties of undefined (reading 'find')
this is the schema for the settings, its imported and exported by a index.js. I’ve also imported all the routes and controllers correctly in the same way I have for other collectionType collections.
{
"kind": "singleType",
"collectionName": "settings",
"info": {
"singularName": "setting",
"pluralName": "settings",
"displayName": "Settings"
},
"options": {
"draftAndPublish": false,
"comment": ""
},
"attributes": {}
}
content-types/index.js
module.exports = {
"notification": require('./notification'),
"pushkey": require('./pushkey'),
"setting": require('./setting'),
};```
routes/index.js
``` 'admin': {
routes: [
// ...notificationsSettings.routes,
{
method: 'GET',
path: '/notifications/setting',
handler: 'setting.find',
config: {
policies: [],
middlewares: [],
prefix: "",
},
},```
controllers/settings.js
```'use strict';
/**
* controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('plugin::notifications-morph.setting');
which is imported into controllers/index.js like this
const notification = require('./notification');
const notifications = require('./notifications');
const setting = require('./setting');
const pushkey = require('./pushkey');
module.exports = {
notification,
notifications,
setting,
pushkey,
};
This topic has been created from a Discord post (1288907882552758283) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord