-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
See #37 for conversation.
Signature
createExpressHandler(disabledHandler: Function) => (enbaledHandler: Function) => ({ requiredFeature: String, features: [ ...Feature ]}) => voidThe user can then use the more specific app.get, app.post etc. and they can still use app.use when their handlers do the method switching themselfs.
import { createExpressHandler } from '@parralleldrive/feature-toggles'
const notFoundHandler = (res, req, next) => {}
const todosHandler = (res, req, next) => {}
const features = []
app.get(
'/todos',
createExpressHandler(
notFoundHandler,
todosHandler,
{ requiredFeature: 'todos', features }
)
)function should be curried or auto-curried.
ericelliott
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request