Validate my custom api key in http node middleware in settings.js

Hi Forum,
New bie here. I want to create a custom API with a API key which I generate in Nodered and want to validate the same API key in httpNodeMiddleware property in settings.js. Whats the best approach to do this?

Why not just use http in -> http response nodes?

What's the reason for involving httpNodeMiddleware?

What's the reason for involving httpNodeMiddleware?

@Steve-Mcl I want to validate the API key in the middleware before the request reaches the flow context.