
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@financial-times/dotcom-middleware-navigation
Advanced tools
This package provides an [Express] compatible middleware which integrates the [FT Navigation] package into your application and adds the navigation data, including editions data, to each response making it available to your application's route handlers. T
This package provides an Express compatible middleware which integrates the FT Navigation package into your application and adds the navigation data, including editions data, to each response making it available to your application's route handlers. This data is required to render the navigation components header and footer.
This package is compatible with Node 12+ and is distributed on npm.
npm install --save @financial-times/dotcom-middleware-navigation
After installing the package create a new instance of the middleware and register it with your application. The middleware can be configured with several options:
const express = require('express')
const app = express()
+ const navigation = require('@financial-times/dotcom-middleware-navigation')
+ app.use(navigation.init())
Once registered, a navigation property will be added to the response locals object containing the navigation data.
app.get('/', (request, response) => {
console.log(response.locals.navigation) // { ... }
})
The middleware accepts the following parameters. All options will be passed along to the FT Navigation package:
enableSubNavigationEnables fetching hierarchical navigation data for the current path including any parent and child pages. Defaults to false.
getCurrentPathEnables overriding of the default current path logic. Defaults to:
(request) => normalizePath(request.get('ft-vanity-url') || request.path)
intervalSee the FT navigation documentation for more details.
subNavigationUrlSee the FT navigation documentation for more details.
menuUrlSee the FT navigation documentation for more details.
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.