Middleware factory for using a single transaction per request. Transactions are only started if a downstream handler requests one. If a transaction is started by the handler, it is automatically committed or rolled back once the handler completes.
Enable the middleware:
app.use(makeDatabaseTransactionMiddleware(knex));