Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.js #5761

Closed
wants to merge 1 commit into from
Closed

Update index.js #5761

wants to merge 1 commit into from

Conversation

ritanshu747
Copy link

@ritanshu747 ritanshu747 commented Jul 14, 2024

By implementing these improvements, Express.js application will be more secure, maintainable, and aligned with best practices. Always stay updated with the latest security advisories and Express.js releases to ensure your application remains secure and efficient.

Copy link
Member

@UlisesGascon UlisesGascon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @ritanshu747! Currently Express@4.x is supporting Node@0.10 so the ES6 syntax is not allowed (const, let, arrow functions, template strings...).

var app = module.exports = express();

// config
const express = require('express');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const express = require('express');
var express = require('../..');

The examples are running as part of the Express tests suite, so express is imported locally and not as an external module

Comment on lines -23 to -24
resave: false, // don't save session if unmodified
saveUninitialized: false, // don't create session until something stored
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove the comments

res.redirect('/login');
}
});
});

/* istanbul ignore next */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove this comment as it will have a negative impact in our tests coverage reports

res.redirect('/login');
}
});
});

/* istanbul ignore next */
if (!module.parent) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove this condition as is designed to help us to run the examples as part of the testing suite or independently.

@UlisesGascon UlisesGascon self-assigned this Jul 14, 2024
@IamLizu
Copy link
Member

IamLizu commented Jul 17, 2024

The current codebase follows JavaScript Standards, so thats worth looking into I guess.

@ritanshu747 ritanshu747 deleted the patch-1 branch July 24, 2024 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants