mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-20 12:03:11 -04:00
feat: gracefully redirect root path in development only (#55403)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
committed by
GitHub
parent
7f2d8a94ea
commit
1570fbf702
@@ -11,6 +11,7 @@ const morgan = require('morgan');
|
||||
|
||||
const { sentry } = require('../../config/secrets');
|
||||
const { setupPassport } = require('./component-passport');
|
||||
const { getRedirectParams } = require('./utils/redirection.js');
|
||||
|
||||
const log = createDebugger('fcc:server');
|
||||
const reqLogFormat = ':date[iso] :status :method :response-time ms - :url';
|
||||
@@ -82,6 +83,14 @@ app.start = _.once(function () {
|
||||
});
|
||||
});
|
||||
|
||||
if (process.env.FREECODECAMP_NODE_ENV === 'development') {
|
||||
app.get('/', (req, res) => {
|
||||
log('Mounting dev root redirect...');
|
||||
const { origin } = getRedirectParams(req);
|
||||
res.redirect(origin);
|
||||
});
|
||||
}
|
||||
|
||||
if (sentry.dsn === 'dsn_from_sentry_dashboard') {
|
||||
log('Sentry reporting disabled unless DSN is provided.');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user