-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Gatsby migration fixes (#1068)
* Add 404 error code for not found page * Fix images loaded status checker for the right column in the documentation * Move images helpers to 'src/utils'. Use these helpers for waiting images load before scroll to anchor after page change. Remove smooth scroll behavior for scroll to top of the page * Rename 'property' to 'name' attribute for description and keywords meta tags * Remove duplication of modal root node * Use 'serve-handler' package for handling trailings slashed in the proper way instead of express.static() * Fix caption styles after code blocks in the docs * Remove wrapper for markdown component * Add compression middleware to server.js * Load algolia docsearch asynchronously to increase initial page load performance * Add bundle-analyzer plugin to allow analyze result webpack bundles * Sentry: DVC-ORG-25. Use crossbrowser method of scrolling to necessary position in the element * Replace Promise polyfill with more lightweight version * Sentry: DVC-ORG-27. Add polyfill for fetch (for IE 11) * Update license in the package.json Co-authored-by: Pavel Grinchenko <[email protected]>
- Loading branch information
1 parent
0381090
commit a629031
Showing
20 changed files
with
372 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,47 @@ | ||
/* eslint-env node */ | ||
|
||
const express = require('express') | ||
const compression = require('compression') | ||
const serveHandler = require('serve-handler') | ||
|
||
const app = express() | ||
|
||
const apiMiddleware = require('./middleware/api') | ||
const redirectsMiddleware = require('./middleware/redirects') | ||
const notFoundMiddleware = require('./middleware/notFound') | ||
|
||
const port = process.env.PORT || 3000 | ||
|
||
app.use(compression()) | ||
app.use(redirectsMiddleware) | ||
app.use('/api', apiMiddleware) | ||
|
||
app.use(express.static('public', { cacheControl: true, maxAge: 0 })) | ||
|
||
app.use(notFoundMiddleware) | ||
app.use((req, res) => { | ||
serveHandler(req, res, { | ||
public: 'public', | ||
cleanUrls: true, | ||
trailingSlash: false, | ||
directoryListing: false, | ||
headers: [ | ||
{ | ||
source: '**/*.@(jpg|jpeg|gif|png)', | ||
headers: [ | ||
{ | ||
key: 'Cache-Control', | ||
value: 'max-age=86400' | ||
} | ||
] | ||
}, | ||
{ | ||
source: '!**/*.@(jpg|jpeg|gif|png)', | ||
headers: [ | ||
{ | ||
key: 'Cache-Control', | ||
value: 'max-age=0' | ||
} | ||
] | ||
} | ||
] | ||
}) | ||
}) | ||
|
||
app.listen(port, () => console.log(`Ready on localhost:${port}!`)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.