Deploy angular rendered app on shared server

笑着哭i 提交于 2019-12-23 02:24:29

问题


I created an Angular 7 app and built it using Angular universal to make it SEO friendly. However, as I was reading, it is not possible to deploy it now on a shared server (once build with Angular universal, otherwise it is possible), since it requires Node.JS to run the script file on server.

My problem is that my hosting plan is on a shared server so I will not be able to run it using Node.JS but I still care of having my app SEO friendly.

What can be a good solution?


回答1:


Angular Universal renders your application in server side before serving the page (SSR). Indeed you will need nodejs to make it work.

You need to prerender your application as static files.

With @ng-toolkit/universal installed you should be able to prerender your application with the command :

npm run build:prerender

Now, you should see new folder dist/static , inside which all your application views should be prerendered and can be served as static files.



来源:https://stackoverflow.com/questions/56515353/deploy-angular-rendered-app-on-shared-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!