const emit = defineEmits();
const setData = (value) => {
emit('set-data', value)
}
@setData
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);
});
}
.h {
float: left;
background-color: blue;
width: 100%;
color: red;
}
@test-event="testMethod()"
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); // не дожидается завершения промиса
});