Categories
Blog Tech

how to solve basic development issues and steps to getup application working

These are the random solution to the issues, faced while developing the application in front-end and these are just the hand tools to fix issues and refer anytime in need. Hope it helps you in your search for solutions. Will keep updating with more and were need of improvement required to this page.


ANGULAR – To use on CLI


//to run server with proxy file optionally can be set under angular.json > server > options >
ng serve –proxy-config proxy.config.json

//if need to add port optionally
ng serve –proxy-config proxy.config.json –port 9999


EXPRESS – To use on CLI


express –view=pug spar-api

create : spar-api\
create : spar-api\public\
create : spar-api\public\javascripts\
.
.

change directory:
> cd spar-api

install dependencies:
> npm install

run the app:
> SET DEBUG=spar-api:* & npm start

On Windows use this command
set DEBUG=myapp:* & npm start

On Mac or linux
DEBUG=myapp:* npm start


TO CREATE SECRECT KEY


Window terminal side of code:

node -e “console.log(require(‘crypto’).randomBytes(256).toString(‘base64’)); #not working with jwt token signing trying other way below:

Source: https://gist.github.com/Holger-Will/3edeea6855f1d69a5368871bce5ea926

(tried on windows 7, working find with angular-jwt app)

generate private key

openssl genrsa -out private.pem 2048

extatract public key from it

openssl rsa -in private.pem -pubout > public.pem


Express side of code:

//Normalizing the path for windows environment
var normalPKPath = path.normalize( __dirname + ‘/private.key’);

const RSA_PRIVATE_KEY = fs.readFileSync(normalPKPath, ‘utf8’);



FIREBASE SETUP FOR ANGULAR CLI PROJECT


Create project in firebase console web page; https://console.firebase.google.com/

install firebase tool

npm install -g firebase-tool

firebase login

Google will try to login with your google account

(prior to init everytime, you have to make angular prod build ready and do firebase init each time for new deployment to firebase server)

firebase init

couple of questions will be asked after init command, type of deployment for web choose Hosting by presseing space bar key after selecting the option in list.
next publish folder path to be, in angular cli its dist folder for production build, type dist and hit enter
next it will ask you is your app is singple page app or not? type yes and hit enter
next it will ask do you want to replace existing index.html with firebase choose now? because our prod build as created file under dist folder.
next will create necessary files in your app directoy related to firebase/

make sure you update enviorments.prod.ts with firebase configuration detail, which you will get object from firebase console Create app for web page by clicking on it,

under project overview page.

next finially execute

firebase deploy

optionally you may use firebase deploy –proiect

if everything fine you will see app running under firebase server


ZEIT NOW – ISSUE SOLUTION


Build failing for typescript file: giving error Error: Cannot find module ‘typescript’

Fix to use @now/node@0.4.28-canary.6: in now.json file to make a build :
solution source: Github Issue https://github.com/zeit/now-builders/issues/181

Example: { “src”: “./src/app/server/*.ts”, “use”: “@now/node@0.4.28-canary.6”}

Categories
Blog Tech

Random Solution to development issues and steps to getup application working

These are the random solution to the issues I have faced while developing the application in front-end and these are my hand tools to fix issues and refer anytime in need. Hope it helps you in your search for solutions. Will keep updating with more and were need of improvement required to this page.

https://gist.github.com/jsbimra/aa63475592b9909a0c7b877ffb7d9667

Categories
Life & Nature

Nature importance to humans and life on this planet!

We do need nature’s work to do our own work in life. So, don’t take nature as not as important as you take much of yourself.

As a human, we don’t produce much excepts our babies, as nature gives us a lot of things for ourself’s and to babies.

As trees are so important, as we work daily for our needs & trees to work for us unconditionally by giving and maintaining oxygen for our life’s, which is very much essential of each individual to live on this planet.

Care for nature, nature will care for you.

Categories
Uncategorized

Amazon Great Indian Festive Season Sale 2018

Amazon Great Indian festive season sale 2018 coming up from 10th of October, buy your loving products at good discounted rates right away from Amazon.

Click on the banner to Shop Now!