UNPKG

fyrejet

Version:

Web Framework for node.js that strives to provide (almost) perfect compatibility with Express, while providing better performance, where you need it.

19 lines (16 loc) 443 B
'use strict' const serveStatic = require('serve-static') module.exports = function (root, options) { const originalMiddleware = serveStatic(root, options) const middleware = (req, res, next) => { const oldNext = next const originalUrl = req.url req.url = req.currentUrl() next = function (err) { req.url = originalUrl oldNext(err) } return originalMiddleware(req, res, next) } return middleware }