Ghost/core/server/web/shared/middleware/pretty-urls.js
Hannah Wolfe 4f9b72ff43
Renamed middlewares to middleware consistently
- This is a minor bugbare, but it will affect some configuration I'm about to do for c8
- I've been wanting to do it for ages, middleware is plural all on it's own so it's an odd affectation in our codebase
- This also only exists in 2 places, everywhere else we use "middleware"
- Sadly it did result in a lot of churn as I did a full find and replace, but consistency is king!
2021-11-16 15:51:47 +00:00

20 lines
638 B
JavaScript

// Pretty URL redirects
//
// These are two pieces of middleware that handle ensuring that
// URLs get formatted correctly.
// Slashes ensures that we get trailing slashes
// Uncapitalise changes case to lowercase
// @TODO optimize this to reduce the number of redirects required to get to a pretty URL
// @TODO move this to being used by routers?
const slashes = require('connect-slashes');
const config = require('../../../../shared/config');
module.exports = [
slashes(true, {
headers: {
'Cache-Control': `public, max-age=${config.get('caching:301:maxAge')}`
}
}),
require('./uncapitalise')
];