http://127.0.0.1:40999/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/.minikube dashboard --port 8888.minikube dashboard --port 8888 адрес.location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:40999/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/;
# 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;
}try_files $uri $uri/ =404; // Get form element
const form = document.querySelector('form');
// Implementation DRY principe, write repeated code into function
const httpRequest = (url, options) => fetch(url, options)
.then(response => response.json())
.then(console.log)
.catch(console.error);
// Create post request options
const postOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
};
// Create get request options
const getOptions = {
method: 'get',
headers: {
'Content-Type': 'application/json',
}
};
// Create post request function
const postRequest = data => httpRequest('http://:3000/info/', {
...postOptions,
body: JSON.stringify(data)
});
// Create get request function
const getRequest = _ => fetch('http://:3000/info/', getOptions)
.then(response => response.json())
.then(console.log)
.catch(console.error);
// Create form handler
const formHandler = (e) => {
// End handler after request
e.preventDefault();
// Get data from form
const data = Object.fromEntries(new FormData(e.target).entries());
// Send post request
postRequest(data);
// Send get request
getRequest();
form.classList.remove('open');
popup.classList.remove('popup_open');
}
// Set form handler
form.addEventListener('submit', formHandler); function Test() {
this.abc = 123;
this.obj = {
try: function() { console.log(this.abc) }
}
return this
}
const t = new Test();
const obj = t.obj.try;
obj.apply(t)