Fix logging and static content serving; Fix user content-creator
parent
4180f66667
commit
2a7dead843
|
@ -33,16 +33,16 @@ mongoose.Promise = global.Promise;
|
|||
// app creation
|
||||
const app = express();
|
||||
|
||||
// Middlewares *************************************************
|
||||
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// logging
|
||||
if (process.env.NODE_ENV !== config.test.env) {
|
||||
app.use(requestLogger('dev'));
|
||||
}
|
||||
|
||||
// Middlewares *************************************************
|
||||
app.use(favicon(path.join(__dirname, '../public', 'favicon.ico')));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// API request checks for API-version and JSON etc.
|
||||
app.use(restAPIchecks);
|
||||
|
||||
|
@ -62,7 +62,7 @@ app.use('/cmd', apiAuthenticationMiddleware, commandRouter);
|
|||
|
||||
// send index.html on all different paths
|
||||
app.use(function (req, res) {
|
||||
res.sendFile("../public/index.html", {root: __dirname});
|
||||
res.sendFile("public/index.html", {root: __dirname});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const config = require('../../config');
|
||||
const mongoose = require('mongoose');
|
||||
mongoose.connect(config.database);
|
||||
mongoose.connect(config.database.uri + config.database.db);
|
||||
const UserModel = require('../../models/user');
|
||||
|
||||
const squads = ['590ddfd93f4b67019d0ad4b5', '590e366bfbe1835513601cc5',
|
||||
'590e367cfbe1835513601cc6', '590f77d33de40440ca826263'];
|
||||
const squads = ['590dd702b899f8050691f09a', '59101b6366d61c085a9f57df',
|
||||
'591025e266d61c085a9f57e1', '591025cf66d61c085a9f57e0', '590d2cf5bd08480bd4ecc128'];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -16,9 +16,18 @@ const quantity = process.argv[2];
|
|||
// CONNECTION EVENTS
|
||||
// When successfully connected
|
||||
mongoose.connection.on('connected', () => {
|
||||
console.log('Mongoose default connection open to ' + config.database);
|
||||
console.log('Mongoose default connection open');
|
||||
});
|
||||
|
||||
const createString = (possible, length) => {
|
||||
let text = "";
|
||||
|
||||
for( let i=0; i < length; i++ )
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
|
||||
return text;
|
||||
};
|
||||
|
||||
for (let i = 0; i < quantity; i++) {
|
||||
const squadId = squads[Math.floor(Math.random() * squads.length)];
|
||||
|
||||
|
@ -46,17 +55,3 @@ process.on('SIGINT', () => {
|
|||
});
|
||||
|
||||
// process.exit();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let createString = (possible, length) =>
|
||||
{
|
||||
let text = "";
|
||||
|
||||
for( var i=0; i < length; i++ )
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
|
||||
return text;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue