When using nodejs instead of Nginx to build a local web development environment, if you want to build a static resource server with an independent domain name and separate domain names for page file resources and static resources, how can you achieve an independent domain name for static resources? Please give me some ideas, thank you!
It is recommended to use nginx, after all, nginx is good at doing this.
If you have to use node, I think you should build two node services to separate dynamic and static resources; one handles page resources; the other only puts static resources; listen to different ports respectively; realize the separation of file resources and static resources;
As for what you said about implementing independent domain names for static resources; in fact, dynamic resources cannot have their own independent domain names, if there are multiple dynamic resources; this requires nginx as a reverse proxy; node web pages recommend using http-proxy, but I don’t have it. Tried it; I used nginx as a reverse proxy.