- Created Test Environment un Server test.freeplanet.app
- mongodb open 2 connections port (3000 and 3001) - 27017 and 27018
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,9 @@
|
||||
node_modules/
|
||||
.env.test
|
||||
.env.development
|
||||
.env.production
|
||||
ESEMPI/
|
||||
.idea
|
||||
package-lock.json
|
||||
deploynodejs_on_production.sh
|
||||
deploynodejs_on_test.sh
|
||||
|
||||
@@ -9,10 +9,19 @@ module.exports = {
|
||||
"PORT": 3000,
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
env_test: {
|
||||
"PORT": 3001,
|
||||
"NODE_ENV": "test",
|
||||
},
|
||||
env_production: {
|
||||
"PORT": 3000,
|
||||
"NODE_ENV": "production",
|
||||
}
|
||||
},
|
||||
log_file: "combined.outerr.log",
|
||||
error_file: "err.log",
|
||||
out_file: "out.log",
|
||||
merge_logs: true,
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ mongoose.Promise = global.Promise;
|
||||
|
||||
mongoose.level = "";
|
||||
|
||||
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
@@ -14,7 +15,7 @@ var options = {
|
||||
// user: process.env.UDB,
|
||||
// pass: process.env.PDB,
|
||||
useMongoClient: true,
|
||||
useNewUrlParser: true,
|
||||
// useNewUrlParser: true, // non supportato
|
||||
promiseLibrary: require('bluebird')
|
||||
|
||||
// useCreateIndex: true,
|
||||
|
||||
@@ -143,7 +143,7 @@ router.post('/login', (req, res) => {
|
||||
if (err) {
|
||||
console.error(`Error occurred while saving subscription. Err: ${err}`);
|
||||
res.status(500).json({
|
||||
error: 'Technical error occurred'
|
||||
error: 'Technical error occurred:' + err
|
||||
});
|
||||
} else {
|
||||
// Send 201 - resource created
|
||||
|
||||
@@ -13,7 +13,7 @@ const path = require('path');
|
||||
|
||||
i18n = require("i18n");
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if ((process.env.NODE_ENV === 'production') || (process.env.NODE_ENV === 'test')) {
|
||||
var privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
|
||||
var certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
|
||||
var credentials = { key: privateKey, cert: certificate };
|
||||
@@ -81,7 +81,6 @@ app.use('/users', users_router);
|
||||
// next(err);
|
||||
// });
|
||||
|
||||
|
||||
// app.set('views', path.join(__dirname, 'views'));
|
||||
// app.set('view engine', 'pug');
|
||||
|
||||
@@ -99,7 +98,7 @@ if (app.get('env') === 'development') {
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if ((process.env.NODE_ENV === 'production') || (process.env.NODE_ENV === 'test')) {
|
||||
var httpsServer = https.createServer(credentials, app);
|
||||
console.log("httpsServer: port ", port);
|
||||
httpsServer.listen(port);
|
||||
|
||||
Reference in New Issue
Block a user