fix: log listening port, remove error (#21)

* fix: log listening port

* fix: remove empty line

* chore: remove unused error

* spacing, ey...

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Tom 2021-08-24 12:15:38 -05:00 committed by GitHub
parent 32bb55e7c4
commit be86d60221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -50,10 +50,9 @@ module.exports = function (app) {
});
});
let error;
app.get('/_api/get-tests', cors(), function(req, res, next){
console.log(error);
if(!error && process.env.NODE_ENV === 'test') return next();
console.log('requested');
if(process.env.NODE_ENV === 'test') return next();
res.json({status: 'unavailable'});
},
function(req, res, next){

View File

@ -47,17 +47,16 @@ app.use(function(req, res, next) {
});
//Start our server and tests!
app.listen(process.env.PORT || 3000, function () {
console.log("Listening on port " + process.env.PORT);
const listener = app.listen(process.env.PORT || 3000, function () {
console.log('Your app is listening on port ' + listener.address().port);
if(process.env.NODE_ENV==='test') {
console.log('Running Tests...');
setTimeout(function () {
try {
runner.run();
} catch(e) {
let error = e;
console.log('Tests are not valid:');
console.log(error);
console.log('Tests are not valid:');
console.error(e);
}
}, 3500);
}