UNPKG

swagger-routes-express

Version:

Connect Express route controllers to restful paths using a Swagger 2 or OpenAPI 3 definition file

13 lines (9 loc) 296 B
const normalisePath = require('../../normalise/normalisePath') const ROOT = 'root' const pathBuilder = basePath => (rawPath, { tags }) => Array.isArray(tags) && tags[0] === ROOT ? normalisePath(rawPath) : `${basePath}${normalisePath(rawPath)}` module.exports = pathBuilder