Posts

Showing posts with the label angular

Deploying an angular app to heroku from github subdirectory

Image
  1.Check Node and Npm version 2.Create Angular App 3.Run app(ng serve) 4.Add "heroku-postbuild": "ng build --prod" and "start": "node server.js"  in scripts in package.json 5. Add  "engines": {    "node": "local machine version",    "npm": "local machine version"  } in package.json 6.Take devDependencies(@angular/cli,@angular/compiler-cli,typescript) to dependencies  in package.json 7.install express server. npm install express path --save 8.Create server.js file in root directory and put this . const express = require('express'); const path = require('path'); const app = express(); app.use(express.static('./dist/appname')); app.get('/*', (req, res) =>     res.sendFile('index.html', {root: 'dist/appname/'}), ); app.listen(process.env.PORT || 8080); 9. add "start": "node server.js" in scripts in in package.json 10.init git repo...

npm install gets stuck at fetchMetadata

  This is how I resolved this after spending half an hour: npm config set registry http://registry.npmjs.org/ --global npm cache clear --force setting package-lock.json to  {}  only npm install --verbose node: v12.14.1 npm: v6.13.4 This issue occure when I tried running  ng update  on angular 6 app to update it to angular 9.

crypto-js angular encryption and java decryption

ANGULAR / JS::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   encode (myString:  string ) {    // PROCESS    const  encodedWord  = CryptoJS.enc.Utf8. parse (myString);  // encodedWord Array object    const  encoded  = CryptoJS.enc.Base64. stringify ( encodedWord );  // string: 'NzUzMjI1NDE='    return  encoded ; } decode (encoded:  string ) {    // PROCESS    const  encodedWord  = CryptoJS.enc.Base64. parse (encoded);  // encodedWord via Base64.parse()    const  decoded  = CryptoJS.enc.Utf8. stringify ( encodedWord );  // decode encodedWord via Utf8.stringify() '75322541'    return  decoded ; } encryptTest (){    console . log ( 'crypto-js' , CryptoJS);    var  decryptedBase64Key  =  'mustbe16byteskey' ;    var  deparsedBase64Key  =...

How to change angular port from 4200 to any other

The solution worked for me was ng serve --port 4401 (You can change 4401 to whatever number you want) Then launch browser ->  http://localhost:4401/

Could not find module "@angular-devkit/build-angular" from

Install  @angular-devkit/build-angular  as dev dependency. This package is newly introduced in Angular 6.0 npm install --save-dev @angular-devkit/build-angular or, yarn add @angular-devkit/build-angular --dev

Deploy Angular Application to Heroku

Image
Making use of the Angular CLI, setup a new project by running : ng new demo-deploy cd demo-deploy ng serve git remote add origin <new_github_repository_url> git add . git commit -m "initial commit" git push -u origin master Setup Automatic Deployment from GitHub     to Heroku: Go to   heroku website . Its free.  Login  to your dashboard and create a new app. Click  Create app Two more simple steps: 1.Under Automatic Deploys, select the master branch and click Enable Automatic Deploys. 2. Under Manual Deploys, click Deploy Branch. This is to push our fresh code to heroku. It might take a little while but will show you successfully deployed message once done. Configure Your Angular App to Deploy Properly on Heroku: Install them into your application by running this commands in your terminal: npm install @angular/cli@latest @angular/compiler-cli --save-dev Create pos...