Q. What is the primary purpose of middleware in a Node.js application?