I'd like to deploy my Angular2 app on my shared hosting. I tried transferring the files via ssh, but the app doesn't run. I guess there is something to do like the ng serve on local.
What do are the steps to follow ? I couldn't find them on the internet :/
Thanks
I have a very simple app with a few routes and components. No serverside code since I'm calling my REST api for my needs.
On your local development machine do an ng build --prod
or ng build --prod --aot
This will build your app into the dist folder. Copy the contents of your dist folder to the public directory of your shared hosting.
Depending on your hosting you may need to configure a web server (nginx, Apache, IIS, etc) to serve your files. Don't run ng serve on your shared hosting.
Unless you plan on running your application in Universal mode, where it rerenders pages server side, do not copy your entire app to your shared host. Do not do an npm install on your shared host. Just copy the built application files in the dist folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With