From 37c942915ef09f3e0a435057fd06d23a57cb6510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3n=20Rodr=C3=ADguez=20Davila?= Date: Wed, 16 Jan 2019 14:58:50 +0100 Subject: [PATCH 1/2] Avoid write files if production mode --- packages/strapi/lib/core/admin.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/strapi/lib/core/admin.js b/packages/strapi/lib/core/admin.js index 010bffe825..1e2f91aca1 100644 --- a/packages/strapi/lib/core/admin.js +++ b/packages/strapi/lib/core/admin.js @@ -58,13 +58,15 @@ module.exports = function() { $('body').attr('back', `/`); } - fs.writeFile(sourcePath, $.html(), (err) => { - if (err) { - return reject(err); - } + if (!strapi.config.currentEnvironment.server.production) { + fs.writeFile(sourcePath, $.html(), (err) => { + if (err) { + return reject(err); + } - resolve(); - }); + resolve(); + }); + } }); }); }); From c9145ae690a1496bade5471ae13cc32539e1ad6f Mon Sep 17 00:00:00 2001 From: Roman Ponomarev Date: Wed, 16 Jan 2019 19:28:18 +0300 Subject: [PATCH 2/2] Update webhooks.md --- docs/3.x.x/guides/webhooks.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/3.x.x/guides/webhooks.md b/docs/3.x.x/guides/webhooks.md index d8103ef950..c6b1b2ff18 100644 --- a/docs/3.x.x/guides/webhooks.md +++ b/docs/3.x.x/guides/webhooks.md @@ -63,10 +63,10 @@ Do the same thing for other environments. #### HTTP call -Now it is time to make the HTTP call. In this example we will use `request` as it is already in the list of Strapi's dependencies. Let's install it: +Now it is time to make the HTTP call. In this example we will use `axios`. Let's install it: ``` -npm i request --save +npm i axios --save ``` Edit `api/yourContentType/models/YourContentType.js`: @@ -76,7 +76,7 @@ Edit `api/yourContentType/models/YourContentType.js`: ```js 'use strict'; -const request = require('request'); +const axios = require('axios'); /** * Lifecycle callbacks for the `Post` model. @@ -119,5 +119,5 @@ So, to trigger an url on delete, please add `request.post(strapi.config.currentE - `delete` action of `plugins/content-manager/services/ContentManager.js` (triggered by the Content Manager). ::: note -Do not forget to require `request` at the top of these files. +Do not forget to require `axios` at the top of these files. :::