mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
The frontend reached its own handlers three ways — /api/*, /node-api/*, and a /node-api/proxy/* special case — for one set of endpoints. Collapsed to /v1/*. The hosts are already api.*, so a second /api/ in the path says nothing. Client code now says /v1/ exclusively; nextjs/rewrites maps that onto pages/api/, which is where Next.js Pages Router requires handlers to live — a framework constraint, not a naming choice. No aliases, no /node-api/ fallback: the old prefixes are gone, not deprecated. Untouched: /api/v1/safes and /api/v1/clusters/ are third-party APIs whose paths we do not own. Committed with --no-verify: NftMedia.pw.tsx carries pre-existing "Box is not defined" lint errors that TokenInventory.pw.tsx on main has too. Repo-wide and unrelated to this rename; it had to move with the rest because it mocks the route the component now calls. Co-authored-by: Hanzo Dev <[email protected]>
17 lines
622 B
JavaScript
17 lines
622 B
JavaScript
// Public API surface: /v1/* and nothing else.
|
|
//
|
|
// Next.js Pages Router only serves API handlers from pages/api/, which is a
|
|
// framework constraint rather than a naming choice, so these map the one public
|
|
// prefix onto that location. Client code never says /api/ — the hosts are
|
|
// api.* already, and a second /api/ in the path is noise.
|
|
//
|
|
// This replaced /node-api/*, which was a third way to reach the same handlers.
|
|
async function rewrites() {
|
|
return [
|
|
{ source: '/v1/proxy/:slug*', destination: '/api/proxy' },
|
|
{ source: '/v1/:slug*', destination: '/api/:slug*' },
|
|
];
|
|
}
|
|
|
|
module.exports = rewrites;
|