Express middleware to render Server Side Includes
npm install @ln-e/ssi-middleware[![NPM version][npm-image]][npm-url]
Express-style middleware to process SSI directives.
The #include supports both static files and _virtual_ paths which are fetched via HTTP(S).
``html`
Other ssi instructions supported via node-ssi
See the basic usage example below. In order to resolve static files the baseDir option has to be provided, respectively baseUrl to resolve virtual paths.
`js
import express from 'express';
import { ssi } from '@ln-e/ssi-middleware';
const app = express();
const port = 3000;
app.use(ssi({
baseDir: ${__dirname}/public,http://localhost:${port}
baseUrl: ,
request: {
// See https://npmjs.com/package/request for options.
// This enables the use of self-signed certificates:
strictSSL: false
},
payloadFn: (req, res) => {
return { GEO: req.headers.COUNTY_BY_IP };
}
}));
app.listen(port);
``
MIT
[downloads-image]: http://img.shields.io/npm/dm/@ln-e/ssi-middleware.svg
[npm-url]: https://npmjs.org/package/@ln-e/ssi-middleware
[npm-image]: http://img.shields.io/npm/v/@ln-e/ssi-middleware.svg