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.
//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 –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’);
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”}
In today’s fast-paced work environment, meetings are essential but can often feel unproductive. However, by…
Gold is one of the most coveted precious metals in the world, adored for its…
Gold, the shimmering metal synonymous with wealth, power, and beauty, has been deeply intertwined with…
How to Onboard an Intern in a Small, Individual-Based Company Hiring an intern can be…