Skip to content

Commit adabdf5

Browse files
committed
Added aditional comments
1 parent 79a9f89 commit adabdf5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/app.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@ const launches = require('./v2-routes/v2-launches');
1616
const upcoming = require('./v2-routes/v2-upcoming');
1717
const parts = require('./v2-routes/v2-parts');
1818

19+
// Production read-only DB
1920
const url = 'mongodb+srv://public:[email protected]/spacex-api';
2021

2122
const app = express();
23+
24+
// Gzip all responses
2225
app.use(compression());
26+
27+
// HTTP header security
2328
app.use(helmet());
29+
30+
// Enable CORS for all routes
2431
app.use(cors());
32+
33+
// Add pretty output option for debugging
2534
app.use(pretty({ query: 'pretty' }));
35+
36+
// Hide logging when running tests
2637
if (process.env.NODE_ENV !== 'test') {
2738
app.use(morgan('common'));
2839
}
@@ -34,6 +45,7 @@ app.use((req, res, next) => {
3445
next();
3546
});
3647

48+
// Express Router routes
3749
app.use('/v2', home);
3850
app.use('/v2/info', info);
3951
app.use('/v2/rockets', rockets);
@@ -51,7 +63,7 @@ app.use((req, res) => {
5163
});
5264
});
5365

54-
// generic error handler - must have 4 parameters
66+
// 500 error handler
5567
// eslint-disable-next-line no-unused-vars
5668
app.use((err, req, res, next) => {
5769
res.status(500);

0 commit comments

Comments
 (0)