Search code examples
angularshared-hosting

Angular : Host assets and javascript on an independent server


I plan to have several embedded web servers in the field accessible over a cellular connection and I'd like to host as much shared static content (ex: javascript, content of assets) as possible on an independent server accessible over a more wallet friendly connection. I'm considering the angular framework but so far my experiments were not very conclusive. Is there a feature of Angular that I could use to implement this properly? Thanks.


Solution

  • You don't need any particular feature to do this. All you need to do is push the static assets in question to the appropriate service and refer to them using the appropriate URL.

    However, doing this manually would be a chore. There are plenty of tools to automate this process, though. For instance, if you were using Gulp as your build tool and wanted to host the files on Amazon's S3, you could use gulp-s3. That way you could run a single command to push the files up (in addition to any other tasks, such as minifying the files). There's many other tools to do the same thing too.

    It's actually very common to serve files like this from a third-party provider or content distribution network and the tooling for it is quite mature.