Thursday, 13 May 2021

what is "dist" folder in angular

dist folder used for deploying angular app in production , because dist folder consists of files compiled from angular(typescript).

In Development, The Angular app runs on the port 4200 with the help of a webpack dev server.(webpack used only in dev, in production only js engine is used it understand only js file not typescript files). This is not the case for running in production. We have to build the Angular project and load those static assets with the node server.

dist folder consists of plain js files compiled from angular and other angular asset files. Let express know there is a dist folder and assets of Angular build

In nodejs index/server.js

app.use(express.static(__dirname + '/dist/proj_name'))

Now angular and nodejs can run on same port in production, In development you can choose to use different server for node and angular.

References
  • https://www.geeksforgeeks.org/how-to-bundle-an-angular-app-for-production/
  • https://medium.com/bb-tutorials-and-thoughts/how-to-develop-and-build-angular-app-with-nodejs-e24c40444421

Tuesday, 4 May 2021

How to find linux distribution and its version

If you are working on virtual machine, you want to know about linux distribution and its version in order to dowload related packages or software. There is a command to know it.

cat /etc/os-release

just run above command on virtual machine

Monday, 3 May 2021

set OPENSSL path in windows

openssl is a library, so no need to install, just set the path in enviorment variables

  • Download openssl from internet. you may find it here : https://sourceforge.net/projects/openssl/
  • Extract inside C:\Program Files\ folder
  • You will find project structure like this C:\Program Files\OpenSSL\bin
  • Set this path in environment variables. Advanced System Settings > Enviroment variables > System Variables > path
  • Run openssl command in command prompt. if you get "WARNING: can't open config file: C:/OpenSSL/openssl.cnf" error, run set OPENSSL_CONF=C:\Program Files\OpenSSL\bin\openssl.cnf
  • if still you are getting C:/OpenSSL/openssl.cnf error, use openssl.conf path while creating certificate / key , for example

    reference : http://irwinj.blogspot.com/2008/11/unable-to-load-config-info-from.html for example : openssl req -new -key my.key -config "C:\Program Files\...\openssl.cnf" -out my.csr

Saturday, 1 May 2021

solving PostgreSql pg_restore.exe path error : C:\Program Files\PostgreSQL\13\pgAdmin 4\runtime\pg_restore.exe not found

You may face this error when you restore stored/backup schemas.Following solution works only in windows.

  • Make sure you have installed postgreSql and pgadmin
  • Goto C:\Program Files\pgAdmin 4\v5 and copy runtime folder
  • Paste runtime folder inside C:\Program Files\PostgreSQL\13\pgAdmin 4
  • Restart pgAdmin and try