Skip to content

Commit

Permalink
Revert "Remove routes/index.js."
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Mar 10, 2019
1 parent a07e3a9 commit d8a6033
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 34 deletions.
51 changes: 17 additions & 34 deletions app.js
Expand Up @@ -38,24 +38,7 @@ const staticify = require('staticify')(PUBLIC_DIR, {
const config = require('./config');
const CSP = require('./config/helmet-csp');
const helpers = require('./lib/helpers');

// routes
const notFoundRoute = require('./routes/404');
const aboutRoute = require('./routes/about');
const booksRoute = require('./routes/books');
const bootlintRoute = require('./routes/bootlint');
const bootswatch4Route = require('./routes/bootswatch4');
const bootswatchRoute = require('./routes/bootswatch');
const dataRoute = require('./routes/data');
const fontawesomeRoute = require('./routes/fontawesome');
const indexRoute = require('./routes/home');
const integrationsRoute = require('./routes/integrations');
const jobsRoute = require('./routes/jobs');
const legacyRoutes = require('./routes/legacy');
const privacyPolicyRoute = require('./routes/privacyPolicy');
const redirectToRoot = require('./routes/redirectToRoot');
const showcaseRoute = require('./routes/showcase');
const themesRoute = require('./routes/themes');
const routes = require('./routes');

const app = express();

Expand Down Expand Up @@ -171,21 +154,21 @@ app.locals.getVersionedPath = staticify.getVersionedPath;
app.locals.semver = semver;

// routes
app.use('/', indexRoute);
app.use('/about/', aboutRoute);
app.use('/alpha/?|/beta/?', redirectToRoot);
app.use('/books/', booksRoute);
app.use('/bootlint/', bootlintRoute);
app.use('/bootswatch/', bootswatchRoute);
app.use('/bootswatch4/', bootswatch4Route);
app.use('/data/bootstrapcdn.json', dataRoute);
app.use('/fontawesome/', fontawesomeRoute);
app.use('/integrations/', integrationsRoute);
app.use('/jobs/', jobsRoute);
app.use('/legacy', legacyRoutes);
app.use('/privacy-policy/', privacyPolicyRoute);
app.use('/showcase/', showcaseRoute);
app.use('/themes/', themesRoute);
app.use('/', routes.indexRoute);
app.use('/about/', routes.aboutRoute);
app.use('/alpha/?|/beta/?', routes.redirectToRoot);
app.use('/books/', routes.booksRoute);
app.use('/bootlint/', routes.bootlintRoute);
app.use('/bootswatch/', routes.bootswatchRoute);
app.use('/bootswatch4/', routes.bootswatch4Route);
app.use('/data/bootstrapcdn.json', routes.dataRoute);
app.use('/fontawesome/', routes.fontawesomeRoute);
app.use('/integrations/', routes.integrationsRoute);
app.use('/jobs/', routes.jobsRoute);
app.use('/legacy', routes.legacyRoutes);
app.use('/privacy-policy/', routes.privacyPolicyRoute);
app.use('/showcase/', routes.showcaseRoute);
app.use('/themes/', routes.themesRoute);

const map = sitemap({
url: 'www.bootstrapcdn.com',
Expand Down Expand Up @@ -246,7 +229,7 @@ if (ENV.ENABLE_CRAWLING) {

app.get('/robots.txt', (req, res) => map.TXTtoWeb(res));

app.use('*', notFoundRoute);
app.use('*', routes.notFoundRoute);

module.exports = app;

Expand Down
42 changes: 42 additions & 0 deletions routes/index.js
@@ -0,0 +1,42 @@
'use strict';

// This file just holds all route requires
const notFoundRoute = require('./404');
const aboutRoute = require('./about');
const booksRoute = require('./books');
const bootlintRoute = require('./bootlint');
const bootswatch4Route = require('./bootswatch4');
const bootswatchRoute = require('./bootswatch');
const dataRoute = require('./data');
const fontawesomeRoute = require('./fontawesome');
const indexRoute = require('./home');
const integrationsRoute = require('./integrations');
const jobsRoute = require('./jobs');
const legacyRoutes = require('./legacy');
const privacyPolicyRoute = require('./privacyPolicy');
const redirectToRoot = require('./redirectToRoot');
const showcaseRoute = require('./showcase');
const themesRoute = require('./themes');

const routes = {
notFoundRoute,
aboutRoute,
booksRoute,
bootlintRoute,
bootswatch4Route,
bootswatchRoute,
dataRoute,
fontawesomeRoute,
indexRoute,
integrationsRoute,
jobsRoute,
legacyRoutes,
privacyPolicyRoute,
redirectToRoot,
showcaseRoute,
themesRoute
};

module.exports = routes;

// vim: ft=javascript sw=4 sts=4 et:

0 comments on commit d8a6033

Please sign in to comment.