Middleware in a Node.js REST API functions as a bridge between the client and server, allowing for additional functionality such as authentication or logging.