Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Redirect packages endpoint to the bower registry (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanmanning committed Mar 14, 2018
1 parent e7c9835 commit 90b8660
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/routes/packages.js
@@ -0,0 +1,18 @@
'use strict';

const cacheControl = require('@financial-times/origami-service').middleware.cacheControl;

module.exports = app => {

const cacheForOneDay = cacheControl({
maxAge: '1 day',
staleWhileRevalidate: '7 days',
staleIfError: '7 days'
});

// Redirect to the components page
app.get(/^\/(packages|stats)(\/.*)?$/, cacheForOneDay, (request, response) => {
response.redirect(301, `https://origami-bower-registry.ft.com${request.url}`);
});

};

0 comments on commit 90b8660

Please sign in to comment.