The War Powers Resolution is a defensive exception to the rule:
The constitutional powers of the President as Commander-in-Chief to introduce United States Armed Forces into hostilities, or into situations where imminent involvement in hostilities is clearly indicated by the circumstances, are exercised only pursuant to (1) a declaration of war, (2) specific statutory authorization, or (3) a national emergency created by attack upon the United States, its territories or possessions, or its armed forces.
It’s illegal.
The War Powers Resolution is a defensive exception to the rule:
https://www.law.cornell.edu/uscode/text/50/1541