Skip to content

ty000/express-middleware-condition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-middleware-condition

unless(middleware, options) Skip middleware when it fulfill the conditions

expectThat(middleware, options) Skip middleware when it does not fulfill the conditions

  • middleware Middleware to skip
  • options Conditions to test
    • [paths] Can be an array of string, an array of object or a string
    • [extensions] Can be a string or an array of string

Paths

Allow to filter on originalUrl and methods

  • path Can be an object or a string
    • urls Can be a string or an array of string
    • [methods] Can be a string or an array of string
{ paths: '/foo' }
{ paths: ['/foo', '/bar'] }
{ paths: [{ urls: '/foo', method: 'GET' }] }
{ paths: [{ urls: ['/foo', '/bar'], method: ['GET', 'PUT'] }] }

Extensions

Allow to filter on the path end extension (with or without the dot)

{ extensions: '*' }
{ extensions: 'jpg' }
{ extensions: '.jpg' }
{ extensions: ['.jpg', 'css'] }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published