Skip to content

Commit

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

// 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 app = express();

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

// routes
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);
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);

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

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

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

module.exports = app;

Expand Down
42 changes: 0 additions & 42 deletions routes/index.js

This file was deleted.

0 comments on commit a07e3a9

Please sign in to comment.