I'm new to Angular 2
, I know host Angular 1.x
on shared hosting like GoDaddy
, but I don't have idea how publish Angular 2
application, for example I have this structure folder:
angular2-quickstart
--app
app.component.ts
main.ts
--node_modules
--typings
index.html
package.json
styles.css
systemjs.config.js
tsconfig.json
typings.json
What file i need to upload on ftp?
I don't tried anything because I don't know how to proceed
Thanks in advance!
Because these files are static, you can host them on any web server capable of serving files; such as Node. js , Java, . NET, or any backend such as Firebase, Google Cloud, or App Engine.
import { LocationStrategy, PathLocationStrategy } from '@angular/common'; Now execute ng build --prod once more and upload the new distribution files to your shared server — everything should now work! That is all you need to begin working with Angular on your very own shared hosting server.
You can have Angular up and running on your web site in minutes by using the Softaculous application installer in cPanel.
Well, you can run ng build in your root application directory. It will create a dist directory containing the app and files. You can put this directory into the page the webserver will look for the index.html
As a component based language, angular 2 includes some caveats in it's deployment process. First, the files used in development environment aren't necessarily shipped to production. In short, you'll only need to upload .js, .html and .css files .
Second is that even if your application works deploying only the files mention above, it's advisable to include the following process:
Bundling: Compiling all the .js files into single files. For instance, vendor.js could include all third party libs and bundle.js would include all application .js files. (Bundles are import for performance reasons, but bear in mind that with the arrival of http 2, this process will be abandoned)
Minification: it's a standard process in all web apps, but now you only minify bundled files.
Take a look in this article, as it give some examples of tools that can help you with deployment process. http://www.ninjaducks.in/hacking/angular-setup/
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