In order to have only one interface for embedded controllers and policies, I create trailpack-controller and trailpack-policies that must use hapi interface for request/reply. In order to these component to work with trailpack-express we need to wrap methods of those component and transform express req/res into dummy hapi request/reply. Like this trailpack that use those class can be compatible with hapi and express very easily.
I didn't know how to do this because hapi allow some things like reply().header('key', 'value').redirect('newURL') and I don't know how make something like this with express API.
In order to have only one interface for embedded controllers and policies, I create
trailpack-controller
andtrailpack-policies
that must use hapi interface for request/reply. In order to these component to work withtrailpack-express
we need to wrap methods of those component and transform express req/res into dummy hapi request/reply. Like this trailpack that use those class can be compatible with hapi and express very easily.I didn't know how to do this because hapi allow some things like
reply().header('key', 'value').redirect('newURL')
and I don't know how make something like this with express API.Any idea ? Any help appreciate ^^