This project was generated with Angular CLI version 1.4.1.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
-
Ensure have latest/working version of angular cli and angular compiler cli or else do
npm install @angular/cli@latest @angular/compiler-cli --save-dev
-
Copy from devDependencies to dependencies
"@angular/cli”: “1.4.9”, "@angular/compiler-cli": "^4.4.6"
-
Create postinstall script in package.json
"postinstall": "ng build --aot -prod"
The above one can throw error sometimes, in that case remove aot & prod -
Add Node and NPM engines
"engines": { "node": "6.11.0", "npm": "3.10.10" }
-
Copy typescript from devDependencies to dependencies
"typescript": "~2.3.3"
-
Install Enhanced Resolve 3.3.0
npm install enhanced-resolve@3.3.0 --save-dev
-
Install express
npm install express --save
-
server.js in root ` //Install express server const express = require('express'); const app = express();
// Serve only the static files form the dist directory app.use(express.static(__dirname + '/dist'));
// Start the app by listening on the default Heroku port app.listen(process.env.PORT || 8080); `
- Change start command
"start": "node server.js"