generated from lidofinance/lido-frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from lidofinance/develop
develop to main
- Loading branch information
Showing
8 changed files
with
127 additions
and
72 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 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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { createServer } from 'http' | ||
import { parse } from 'url' | ||
import next from 'next' | ||
import { CACHE_CONTROL_HEADER } from './next.config.mjs' | ||
|
||
const dev = process.env.NODE_ENV !== 'production' | ||
const hostname = 'localhost' | ||
const port = 3000 | ||
// when using middleware `hostname` and `port` must be provided below | ||
const app = next({ dev, hostname, port }) | ||
const handle = app.getRequestHandler() | ||
|
||
app.prepare().then(() => { | ||
createServer(async (req, res) => { | ||
// Be sure to pass `true` as the second argument to `url.parse`. | ||
// This tells it to parse the query portion of the URL. | ||
const parsedUrl = parse(req.url, true) | ||
|
||
const setHeader = res.setHeader | ||
let cacheControlOverwritten = false | ||
res.setHeader = function(header, value) { | ||
if (header.toLowerCase() === CACHE_CONTROL_HEADER) { | ||
cacheControlOverwritten = true | ||
return setHeader.call(this, 'Cache-Control', value) | ||
} | ||
|
||
if (header.toLowerCase() === 'cache-control' && cacheControlOverwritten) { | ||
return this | ||
} | ||
|
||
return setHeader.call(this, header, value); | ||
} | ||
|
||
await handle(req, res, parsedUrl) | ||
}) | ||
.once('error', (err) => { | ||
console.error(err) | ||
process.exit(1) | ||
}) | ||
.listen(port, () => { | ||
console.log(`> Ready on http://${hostname}:${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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from './default-error-handler'; | ||
export * from './fetchRPC'; | ||
export * from './withCsp'; |
This file was deleted.
Oops, something went wrong.