1 The general static directory setting looks like this: App. Use (Express. Static (Path. Join (_ _ dirname,’ public’));
But the boss asked us to put the static files on another server, so we need to point to another address, for example: app.use (exress.static (‘www.aaa.com/public’);
However, it seems that express cannot support this. Seek a solution and ask the Great God to point out the secret situation.
You need to apply for a Second-level domain. For example, your current domain name is www.foo.com, then the new Second-level domain may be static.foo.com or js.foo.com.
The DNS of the new domain name points to the new server. Of course, the new service needs to be configured with a web server and all static resources will be copied.
Modify the HTML template of the current project and change the domain name of static resources to static.foo.com .
This is it. It has nothing to do with your express. New Web Server, New Domain Name, New Template. That’s all.