This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('express')() | |
const getRoute = (req) => { | |
const route = req.route ? req.route.path : '' // check if the handler exist | |
const baseUrl = req.baseUrl ? req.baseUrl : '' // adding the base url if the handler is child of other handler | |
return route ? `${baseUrl === '/' ? '' : baseUrl}${route}` : 'unknown route' | |
} | |
const fs = require('fs') |