app.use() registers Express/Fastify middleware directly — it works but bypasses NestJS DI so it cannot inject services. NestJS middleware classes implement NestMiddleware, are decorated with @Injectable(), and are applied via configure() in a module implementing NestModule — allowing them to use injected services.
app.use() — functional middleware, no DI, registered globally.
NestJS middleware — class-based, supports DI, can be scoped to specific routes.
NestJS middleware can be excluded from specific routes using .exclude().
Use app.use() for simple third-party middleware (helmet, cors, compression).