Jpatel
Jpatel

Reputation: 45

How to deploy Angular2 app develop using angular-cli and NodeJS on tomcat

I am new to Angular(1 or 2). I have built a small application using Angular-cli and running on NodeJs. But my production env is using Tomcat. Is there a way to do it without making lots of changes in my project?

Upvotes: 1

Views: 596

Answers (2)

Jpatel
Jpatel

Reputation: 45

I see many people asking for the answer. Here are the steps which are working now.

  1. Create your project using CLI.
  2. Once you have working project, go to your project folder in command window and build using ng build --prod
  3. All your built files will be in dist folder.
  4. Copy all the files from dist folder to the webapps folder of Tomcat. This is the most important step. Without this you will only see "Loading..."
  5. In index.html, change <base href="/"> to <base href=".">

Upvotes: 0

Ben Richards
Ben Richards

Reputation: 3575

Yes, Angular project is just JavaScript/TypeScript and HTML. You can deploy it on any web server by simply coping the files. Or you can use something like WebPack to minify/bundle everything into single JavaScript and HTML files, and copy that to your web server.

Upvotes: 2

Related Questions