Skip to content

Commit

Permalink
chore: Rewrite info v3 (#10843)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->


<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `rewrites` function in `next.config.mjs` to include
a new structure for handling URL rewrites, adding `beforeFiles` and
`afterFiles` sections, and introduces several new rewrite rules for
deprecated endpoints.

### Detailed summary
- Changed the return value of the `rewrites` function from an array to
an object.
- Added `afterFiles` section with existing rewrite rules for
`/info/token/:address`, `/info/pool/:address`, and
`/.well-known/vercel/flags`.
- Introduced `beforeFiles` section with new rewrite rules for deprecated
endpoints at `/info/v3` and its sub-paths.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chefjackson authored Oct 21, 2024
1 parent ececb86 commit 36c89ae
Showing 1 changed file with 39 additions and 14 deletions.
53 changes: 39 additions & 14 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,45 @@ const config = {
],
},
async rewrites() {
return [
{
source: '/info/token/:address',
destination: '/info/tokens/:address',
},
{
source: '/info/pool/:address',
destination: '/info/pools/:address',
},
{
source: '/.well-known/vercel/flags',
destination: '/api/vercel/flags',
},
]
return {
afterFiles: [
{
source: '/info/token/:address',
destination: '/info/tokens/:address',
},
{
source: '/info/pool/:address',
destination: '/info/pools/:address',
},
{
source: '/.well-known/vercel/flags',
destination: '/api/vercel/flags',
},
],
beforeFiles: [
// TODO: remove rewrite once explorer is fixed
{
source: '/info/v3',
destination: 'https://deprecated-info.pancake.run/info/v3',
},
{
source: '/info/v3/pairs',
destination: 'https://deprecated-info.pancake.run/info/v3/pairs',
},
{
source: '/info/v3/tokens',
destination: 'https://deprecated-info.pancake.run/info/v3/tokens',
},
{
source: '/info/v3/tokens/:path*',
destination: 'https://deprecated-info.pancake.run/info/v3/tokens/:path*',
},
{
source: '/info/v3/pairs/:path*',
destination: 'https://deprecated-info.pancake.run/info/v3/pairs/:path*',
},
],
}
},
async headers() {
return [
Expand Down

0 comments on commit 36c89ae

Please sign in to comment.