server {
listen 80;
listen [::]:80 default_server ipv6only=on;
server_name www.sub-1.domain.com sub-1.domain.com;
root /var/www/sub-1.domain.com;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:2000;
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;
}
}
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
server_name www.sub-2.domain.com sub-2.domain.com;
root /var/www/sub-2.domain.com;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost: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;
}
}
function createQueryString(obj) {
const query = new URLSearchParams()
for (const key in obj) {
if (Object.hasOwn(obj, key)) {
const item = obj[key]
if (!Array.isArray(item))
query.append(key, String(item))
else {
for (const el of item) {
query.append(key, String(el))
}
}
}
}
return query.toString()
}
const args = {
hi: 'there',
id: ['1', '2', '3']
}
console.log(createQueryString(args))
const defObj = {
a: { label: string, value: number },
b: { label: string, value: string },
c: { label: string, value: boolean }
}
type Generic =
| { label: string, value: number }
| { label: string, value: string}
| { label: string, value: boolean}
type Test = Record<string, Generic>