docs/middleware/dev-toc.js

10 строки
335 B
JavaScript

const { liquid } = require('../lib/render-content')
const layouts = require('../lib/layouts')
module.exports = async (req, res, next) => {
if (process.env.NODE_ENV !== 'development') return next()
if (!req.path.endsWith('/dev-toc')) return next()
return res.send(await liquid.parseAndRender(layouts['dev-toc'], req.context))
}