2.0.0 • Published 6 years ago

next-link v2.0.0

Weekly downloads
238
License
MIT
Repository
github
Last release
6 years ago

next-link

npm version

next-routes helper function copies link preload tags in head of initial response into link header where proxy will server push them. This significantly decreases the initial "time to interactive" latency for first time users.

All routes that are server push enabled must be defined in the next-routes file.

TODO:

  • send/check a cookie with buildId so we know if resources need to be pushed for this build
  • figure out how to make this work without next-routes

Usage

Add it to the express app like this:

const nextLink = require('next-link')
const routes = require("./routes");

const nextLinkRouterHandler = routes.getRequestHandler(app, ({req, res, route, query}) => {
        nextLink(app, req, res, route.page, query);
    }
);

const app = express()

app.use(nextLinkRouterHandler)
2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago