server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
location / {
root /var/www/example.com/;
index index.html;
}
location /server/ {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
app.post('/var/www/example.com/server/'
советую почитать доку, посмотреть примеры.const input = document.querySelector('input');
input.addEventListener('beforeinput', (e) => {
console.log('oldValue', e.target.value);
})
input.addEventListener('input', (e) => {
console.log('value', e.target.value);
})
function later(delay) {
return new Promise(function(resolve) {
setTimeout(resolve, delay);
});
}
const arr = [];
const addObj = (obj) => {
if(!arr.length) {
arr.push(obj);
console.log(arr);
return;
}
if(arr.some(n => n.width === obj.width && n.height === obj.height)) {
console.log('Такой элемент уже существует');
} else {
arr.push(obj);
console.log(arr);
}
}
addObj({width: 5, height: 2});
addObj({width: 1, height: 3});
addObj({width: 5, height: 2}); // "Такой элемент уже существует"
app.get('/city/:name', async (req, res) => {
await requestGeo(req.params.name);
res.send(today);
});
почему так происходит?
app.get('/city/:name', (req, res) => {
requestGeo(req.params.name); // ушло в промис
res.send(today); // не дожидается завершения промиса
});
const cards = document.querySelectorAll('.card__element');
const a = document.querySelector('.a'),
b = document.querySelector('.b'),
c = document.querySelector('.c');
const input = document.querySelector('.input')
const array = [a,b,c]
let pup = []
for (let element of array) {
element.addEventListener('click', ({target})=>{
if(['a','b'].includes(target.value)) {
pup.push(target.value)
} else {
pup.pop()
}
input.value = pup.join('')
})
}
const simpleString = '7911xxxxxxx';
const validateStr = (str) => {
let result = '';
if (typeof str !== 'string') throw 'Parameter is not a string!';
if (str.length >= 10) throw 'Phone is incorrect!';
if (str[0] === '7') result = '+' + str;
return str;
}