Open the ~/.bashrc
file and find the following code
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Open the ~/.bashrc
file and find the following code
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
require('dotenv').config(); | |
exports.basicAuth = function (req, res, next) { | |
// authentication middleware | |
const auth = { login: process.env.LOGIN, password: process.env.PASSWORD }; // change this | |
// parse login and password from headers | |
const b64auth = (req.headers.authorization || '').split(' ')[1] || ''; | |
const [login, password] = Buffer.from(b64auth, 'base64') | |
.toString() |
Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**
Create a new repository, or reuse an existing one.
Generate a new SSH key:
ssh-keygen -t ed25519 -C "your_email@example.com"
Note: If you are using a legacy system that doesn't support the Ed25519 algorithm, use:
ssh-keygen -t rsa -C "your_email@example.com"
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user