mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
db0a723db9
Adds support for output: "export" mode to the Segment Cache implementation. We output an additional `.txt` data file per segment per page. When the client issues a per-segment request, it appends the segment path to the end of the page URL, rather than passing it as a request header. The segment file output follows this convention: ``` /a/b/c.html /a/b/c/__next.a.txt <- corresponds to segment /a /a/b/c/__next.a.b.txt <- corresponds to segment /a/b /a/b/c/__next.a.b.c.txt <- corresponds to segment /a/b/c ... and so on ``` This scheme is designed so that the server can implement patterns like protection rules or rewrites using just the original path. i.e. by blocking access to `/a/b`, you also block access to all of its associated segment data. Technically it's possible for the segment files to clash with a nested segment config. We add a `__next` prefix to make a clash less likely. It's unlikely this will ever be an issue in practice but if needed we could make this prefix configurable at build time.
7 lines
149 B
JavaScript
7 lines
149 B
JavaScript
import { server } from './server.mjs'
|
|
|
|
const port = 3000
|
|
server.listen(3000, () => {
|
|
console.log(`Server running at http://localhost:${port}/`)
|
|
})
|