backend-plus 2.5.0-betha.3 → 2.5.2-betha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/backend-plus.d.ts +1 -0
- package/lib/backend-plus.js +13 -0
- package/package.json +2 -1
package/lib/backend-plus.d.ts
CHANGED
package/lib/backend-plus.js
CHANGED
|
@@ -30,6 +30,7 @@ var locatePath = require('@upgraded/locate-path');
|
|
|
30
30
|
var jsYaml = require('js-yaml');
|
|
31
31
|
var nodemailer = require('nodemailer');
|
|
32
32
|
var os = require('os');
|
|
33
|
+
const cors = require('cors');
|
|
33
34
|
|
|
34
35
|
var likeAr = require('like-ar');
|
|
35
36
|
|
|
@@ -902,6 +903,18 @@ AppBackend.prototype.start = function start(opts){
|
|
|
902
903
|
}).then(async function(){
|
|
903
904
|
mainApp = express();
|
|
904
905
|
//mainApp.use(cookieParser());
|
|
906
|
+
const whitelist = ['localhost'].concat(be.config.server.allowedHosts||[]); // Agrega aquí los orígenes de tus aplicaciones
|
|
907
|
+
const corsOptions = {
|
|
908
|
+
origin: function (origin, callback) {
|
|
909
|
+
if (whitelist.some((element)=>origin?.includes(element)) || !origin){
|
|
910
|
+
callback(null, true);
|
|
911
|
+
}else{
|
|
912
|
+
callback(new Error('Not allowed by CORS'));
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
credentials: true
|
|
916
|
+
};
|
|
917
|
+
mainApp.use(cors(corsOptions));
|
|
905
918
|
mainApp.use(bodyParser.urlencoded({extended:true, limit: '50mb'}));
|
|
906
919
|
mainApp.use(function(req,res,next){
|
|
907
920
|
if((req.headers['content-type']||'').match(/^multipart\/form-data/)){
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-plus",
|
|
3
3
|
"description": "Backend for the anti Pareto rule",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.2-betha.4",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"castellano": "^0.1.4",
|
|
40
40
|
"connect-pg-simple": "^10.0.0",
|
|
41
41
|
"cookie-parser": "^1.4.7",
|
|
42
|
+
"cors": "^2.8.5",
|
|
42
43
|
"dialog-promise": "^0.10.1",
|
|
43
44
|
"discrepances": "^0.2.8",
|
|
44
45
|
"express": "^5.1.0",
|