backend-plus 2.5.0-betha.0 → 2.5.1-betha.0
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
|
|
|
@@ -893,6 +894,18 @@ AppBackend.prototype.start = function start(opts){
|
|
|
893
894
|
}).then(async function(){
|
|
894
895
|
mainApp = express();
|
|
895
896
|
//mainApp.use(cookieParser());
|
|
897
|
+
const whitelist = ['localhost'].concat(be.config.server.allowedHosts||[]); // Agrega aquí los orígenes de tus aplicaciones
|
|
898
|
+
const corsOptions = {
|
|
899
|
+
origin: function (origin, callback) {
|
|
900
|
+
if (whitelist.some((element)=>origin?.includes(element)) || !origin){
|
|
901
|
+
callback(null, true);
|
|
902
|
+
}else{
|
|
903
|
+
callback(new Error('Not allowed by CORS'));
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
credentials: true
|
|
907
|
+
};
|
|
908
|
+
mainApp.use(cors(corsOptions));
|
|
896
909
|
mainApp.use(bodyParser.urlencoded({extended:true, limit: '50mb'}));
|
|
897
910
|
mainApp.use(function(req,res,next){
|
|
898
911
|
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.1-betha.0",
|
|
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",
|