Posts

Showing posts from February, 2020

[React] How to create web application

Image
This blog is going to tell you how to create the web application using React.js 1. Go to react website to get first tutorial https://reactjs.org/tutorial/tutorial.html - Make sure you have a recent version of Node.js installed. - Follow the installation instructions for Create React App to make a new project. Install NodeJS Node >= 8.10 (v13.5.0) and npm >= 5.6 (6.13.4) on your machine. To create a project, run: npx create-react-app my-app  cd my-app  npm start This will let you go to url :  http://localhost:3000/ 2. Install YARN > npm install -g yarn 2. Add bootstrap go to react  https://reactstrap.github.io/ > npm install --save reactstrap react react-dom > npm install --save bootstrap or > yarn add bootstrap reactstrap 4. Add AXIOS > npm install axios --save 5. Add .env to root folder     Define key and value as needed e.g. PORT=3001 Alternative Re...

[Grandma] Run Web & API

Image
Forever We use forever to make server run all the time > sudo npm install -g forever > forever list > forever stop 0 > forever restart 0 > forever -w server.js> forever server.js > forever yarn https Reference [1]  https://www.npmjs.com/package/forever [2]  https://stackoverflow.com/questions/12701259/how-to-make-a-node-js-application-run-permanently 1. Web > node server.js or > forever start -c "node server.js" ./ 2. API > npm start > yarn https or >  forever start -c "npm start" ./ > To support https in loopback

[Version] How to check version of each application or OS

1. CentOS Use any command: > cat /etc/os-release > hostnamectl > rpm -qa centos-release > $ uname -r 2. Node > node -v 3. NPM > npm -v 4. Angular > ng -v 5. Node package > ng -v

[Cheat Sheet] Linux Command

1. Real time monitor CPU/RAM/Disk > top 2. See command history > history | less > history | tail > history 25 3. Exit | less type q 4. Check port using > netstat -tulpn | grep :443 5. Stop service > service httpd stop

[HTTPS] on centos using letsencrypt (Free SSL)

Right now, chrome browser will verify trusted ssl. If you use any ssl cert, it will show some warning which make users feel uncomfortable.  Let's see which ssl we can use for free. I have a chance to try one cert authority names 'Let's encrypt' Please see the instructions how to use it. My Environment 1. CentOS 7 Step  1. Install certbot client.  https://certbot.eff.org/ wget https://dl.eff.org/certbot-auto sudo mv certbot-auto /usr/local/bin/certbot-auto sudo chown root /usr/local/bin/certbot-auto sudo chmod 0755 /usr/local/bin/certbot-auto 2. Run certbot sudo /usr/local/bin/certbot-auto certonly --standalone https://certbot.eff.org/docs/install.html 3. Put your public and private key into secured folder e.g.  /etc/letsencrypt/live/... 4. Run automatic renewal echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/cron...

[HTTPS] on nodejs and Centos using openssl

Image
1. First of all, you have to create private & public key - Install the system-specific openssl from this link . - Create openssl.cfg  http://www.flatmtn.com/article/setting-openssl-create-certificates.html - Set the following variable : set OPENSSL_CONF=LOCATION_OF_SSL_INSTALL\bin\openssl.cfg Update the path : set Path=...Other Values here...;LOCATION_OF_SSL_INSTALL\bin - Run > openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 - Double click at localhost.crt 2. Create "server.js" const { createServer } = require('https'); const { parse } = require('url'); const next = require('next'); const fs = require('fs'); const dev = process.env.NODE_ENV !== 'production'; const app = next({ dev }); const handle = app.getRequestHandler(); const httpsOptions = {   key: fs.readFileSync('./certificates/localhost.key'),   cert: fs.readFileSync('./certif...