Im using strapi api for my backend and i went and created a new collection called placed-orders which i will use for posting orders.In my controller file, I modified it but i keep getting the error mentioned above.This is the placed-order.js file in my controller folder. I can’t seem to find a working solution online. Any insights will be appreciated.
"use strict";
/**
* placed-order controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::placed-order.placed-order', ({strapi})=>({
async create(ctx) {
try {
const data = ctx.request.body;
const submission = await strapi.services.order.create(data);
return { success: true, submission };
} catch (err) {
ctx.throw(500, err);
}
},
}));