Ctrl+C
process.exit();
const s3 = new AWS.S3(
{ accessKeyId: IAM_USER_KEY, /* required */# Put your iam user key
secretAccessKey: IAM_USER_SECRET, /* required */ # Put your iam user secret key
Bucket: BUCKET_NAME /* required */ # Put your bucket name
}
);
s3.deleteObject({
Bucket: MY_BUCKET,
Key: 'some/subfolders/nameofthefile1.extension'
},function (err,data){})
var token = jwt.sign({email_id:'123@gmail.com'}, "Stack", {
expiresIn: "10h" // it will be expired after 10 hours
//expiresIn: "20d" // it will be expired after 20 days
//expiresIn: 120 // it will be expired after 120ms
});
var token = jwt.sign({email_id:'123@gmail.com'}, "Stack", {
expiresIn: '24h' // expires in 24 hours
});
app.use(express.static('public'))
app.use(express.static('files'))
kubectl get nodes -o json | jq '.items[].spec'
var http=require('http');
var ports = [7006, 7007, 7008, 7009];
var servers = [];
var s;
function reqHandler(req, res) {
console.log({
remoteAddress: req.socket.remoteAddress,
remotePort: req.socket.remotePort,
localAddress: req.socket.localAddress,
localPort: req.socket.localPort,
});
}
ports.forEach(function(port) {
s = http.createServer(reqHandler);
s.listen(port);
servers.push(s);
});
var http=require('http');
var url = require('url');
var ports = [7006, 7007, 7008, 7009];
var servers = [];
var s;
function reqHandler(req, res) {
var serPort=req.headers.host.split(":");
console.log("PORT:"+serPort[1]);//here i get it using http header.
}
ports.forEach(function(port) {
s = http.createServer(reqHandler);
s.listen(port);
servers.push(s);
});
var express = require('express');
let app1 = express();
let app2 = express();
app1.listen(3000, () => {
console.log("Started server on 3000");
});
app2.listen(3002, () => {
console.log("Started server on 3002");
});
$ npm config delete http-proxy
$ npm config delete https-proxy
$ npm config set proxy http://localhost:3128
$ npm config set https-proxy http://localhost:3128
export const registrationSchema = {
"email": {
notEmpty: true,
isEmail: {
errorMessage: "Invalid Email"
}
},
"password": {
notEmpty: true,
isLength: {
options: [{min: 12}],
errorMessage: "Must be at least 12 characters"
},
matches: {
options: ["(?=.*[a-zA-Z])(?=.*[0-9]+).*", "g"],
errorMessage: "Password must be alphanumeric."
},
errorMessage: "Invalid password"
},
"firstName": {
notEmpty: false,
isLength: {
options: [{max: 200}],
errorMessage: "The first name must be under 200 characters"
},
matches: {
options: ["^[a-z ,.'-]+$", "i"],
errorMessage: "The first name can only contain letters and the characters (,.'-)"
}
},
"lastName": {
notEmpty: false,
isLength: {
options: [{max: 200}],
errorMessage: "The last name must be under 200 characters"
},
matches: {
options: ["^[a-z ,.'-]+$", "i"],
errorMessage: "The last name can only contain letters and the characters (,.'-)"
}
}
};