微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何访问trapi中名称中包含特殊字符的文件?

如何解决如何访问trapi中名称中包含特殊字符的文件?

这是我的 Strapi 应用程序的目录结构(在一个特定模型中)

this is the directory structue

在访问 car-comapany.js 中的服务时出现错误

这是我尝试访问的方式

module.exports = {
//DESCRIPTION : GET ALL THE CAR COMPANIES
find: async (ctx) => {
    const file = "car-company"
    const data = await strapi.services.car-company.getall(ctx); //this is the actual line where i need to access the particular method inside services folder.
    if(data.statusCode==200){
        ctx.send(
            data.message.map(entity => sanitizeEntity(entity,{ 
                model: strapi.models.car-company 
            })),data.statusCode)
    }else{
        ctx.send(
            data,data.statusCode
            )
      }
    },};

我得到的错误ReferenceError: company is not defined exactly at this line -->const data = await strapi.services.car-company.getall(ctx);

非常感谢任何帮助。谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。