How to Write Custom Middlewares


There are examples of how to create hooks for Jovo-supplied middlewares.

I am wondering if it is possile to create your own middlewares (either stand-alone or as part of a plugin) that an app developer (or developers using your plugin) could then take advantage of?

What are some examples of what you can do with custom middlewares?



What are the differences/benefits to using middleware vs hooks?

app.middleware('after.platform.init').use((handleRequest) => { 
  // handleRequest.jovo 


app.hook('after.platform.init', (error, host, jovo) => {
  // jovo