strapi

Strapi Plugin Route Default Permission

情到浓时终转凉″ 提交于 2019-12-24 20:52:00
问题 I am building a plugin for Strapi with several routes, for example: { "method": "GET", "path": "/preAnalyzeImportFile", "handler": "ImportConfig.preAnalyzeImportFile", "config": { "policies": ["global.isAuthenticated"] } } When the plugin is installed, any authenticated user should be able to use the new routes. I can change the permissions manually so that the routes work, but that should not be a required workflow to use the plugin. How do I set default permissions for plugin routes? 回答1:

Strapi Beta with custom Sendgrid Controller code for email

自闭症网瘾萝莉.ら 提交于 2019-12-22 18:11:54
问题 The structure for Strapi beta has changed how plugins are architected, removing the /plugins directory and the plugins are now kept in the /node_modules directory. I am trying to write some custom code to fire a confirmation email after an order is placed. In the previous version of Strapi, the email plugin directory was here: /server/plugins/email/controllers In this directory, the following code was wrote that is working in alpha in the SEND controller: We comment this out: // await.strapi

Strapi Beta with custom Sendgrid Controller code for email

拜拜、爱过 提交于 2019-12-22 18:08:00
问题 The structure for Strapi beta has changed how plugins are architected, removing the /plugins directory and the plugins are now kept in the /node_modules directory. I am trying to write some custom code to fire a confirmation email after an order is placed. In the previous version of Strapi, the email plugin directory was here: /server/plugins/email/controllers In this directory, the following code was wrote that is working in alpha in the SEND controller: We comment this out: // await.strapi

How to integrate Strapi API and Admin Panel with another node app (that consumes Strapi API)?

不想你离开。 提交于 2019-12-21 21:34:58
问题 I'm trying to develop an app that uses Strapi Admin Panel api generation, and, at the same time, serves as a website that consumes this api. So, basically, I'm trying to build a website: where /api route servers as a Strapi API endpoint where /admin route serves as a Strapi Admin Panel for API creation where all the other routes are configured to serve my website, i.e.: / route is the landing page of my website /contacts is the contacts page etc. And, moreover, the static files of the website

How to add a non-user-editable field to a content type in Strapi?

半城伤御伤魂 提交于 2019-12-13 04:35:32
问题 Say I have a post content type with the following 4 fields: title (string) content (string) slug (string) author (relationship) How can I add a 5th field that depends on one of the above 4 fields for its value and isn't user-editable? Say, I wanted a wordCount field with the number of words in the content field as its value. What file should I consider exploring in order to incorporate this functionality? P.S.: For what it's worth, I'm using MongoDB Atlas for my database needs. 回答1: You will

I am Getting Strapi Email Api Error in Response : Internal Server Error

倖福魔咒の 提交于 2019-12-11 17:44:48
问题 Getting "Internal Server Error" in response in Postman of Strapi Email API "http://localhost:1337/email" In VS Code Debug Console i am also getting this: Error: Cannot wrap non-Error object application.js:190 at Object.exports.assert (f:\app\node_modules\hoek\lib\index.js:740:11) at Object.exports.wrap (f:\app\node_modules\boom\lib\index.js:95:10) at strapi.app.use (f:\app\node_modules\strapi\lib\middlewares\boom\index.js:40:20) at process._tickCallback (internal/process/next_tick.js:68:7)

Bootstraping Strapi Role Permissions

倾然丶 夕夏残阳落幕 提交于 2019-12-11 08:45:53
问题 I am a developer that is doing front end work, strapi and javascript for the first time. I hope someone could take pity on me and provide an example of how to set the Public role permissions via a bootstrap.js script. node.js v10.16.0 Strapi v3.0.0-next.11 Graphql 14.3.1 MongoDB: 3.6 All on Windows 10 In the Strapi UI, it is the Roles and Permissions for the Public Role I want to set these boxes to CHECKED Another developer has used the bootstrap.js file to add items to the services we

How do I return only selected certain fields in Strapi?

被刻印的时光 ゝ 提交于 2019-12-10 20:56:54
问题 Pretty straightforward (I hope). I'd like to be able to use the API endpoint and have it only return specified fields. I.E. something like this http://localhost:1337/api/reference?select=["name"] Would ideally return something of the form [{"name": "Ref1"}] Unfortunately that is not the case, and in actuality it returns the following. [ { "contributors": [ { "username": "aduensing", "email": "standin@gmail.com", "lang": "en_US", "template": "default", "id_ref": "1", "provider": "local", "id":

How to pass JSON object in grpahql and strapi

那年仲夏 提交于 2019-12-08 07:58:16
问题 When I manually write the mutation query (in graphql plugin), it's working: mutation { createExam(input: { data: { name: "myName" desription: "ggg" questions: [{gf: "hello"}] time: 2 subjects: ["5c468e2d61670b25b46ccdfe"] } }) { exam { name desription time } } } But if I code it and pass the exact same array I get an array of the exact same object I get [null, null] let parsedQuestion = [{gf: "hello"}]; const response = await strapi.request('POST', '/graphql', { data: { query: `mutation {

Strapi : is it possible to track users modifying content?

偶尔善良 提交于 2019-12-08 04:52:21
问题 I'm currently doing some research on Strapi in order to build my API on it, and I was wondering if it's possible to expose in the JSON a field that would contain information about the user responsible for the last modification on a particular content ? I know the API exposes an "updatedAt" field in the JSON object by default that contains the datetime it was last updated, but as I understand it this field is handled by the database when the data is sent to it for persistance ? Any help would