3
votes

I have created Angular-universal app with reference to this Angular GitHub Repository. I have used node express for server-side rendering.

I have built using this command

npm run build:prod:ngc

now I got the client and the server folder in the dist folder. No other files there like index.html.

Previously I developed the angular2 app using CLI, on building that it create a dist folder with bundle.js, index.html, and CSS files. I used to upload that particular thing to shared hosting. The app was working fine. But in angular universal I am confused. I am stuck on how to proceed further for production. I have the shared hosting, Please help me how to host the project in shared hosting.

1
I have the same questions with you. Did you find your answer?? - Michalis
@Michalis No i didnt find - Abinaya Thoomatti Sethuraman
Most shared hosting cannot provide nodejs server hosting, if you do find one that supports this, you will need to use rewrite engine/nginx after starting the nodejs application usinde node /dist/server or something similar, if you need it persistant use pm2 - Cacoon

1 Answers

0
votes

With universal you have to set up the server first and then start the server to listen at some port(80 normally :P)..

normally.. once you setup the node server on the hosting area, you can just go to your source code and start the server using cmd:-

sudo PORT = 80 npm run server (if ubuntu)

to listen at port 80 and then you can access the site then using IP/domain name.