Making a bot that checks to see if a message replied to is a photograph (node-telegram-bot-api 2024)

So I am making a simple telegram bot that replies with a message if the message replied to is a photograph, but the property of the node-telegram-bot library of the “message” object, reply_to_message, is undefined.

Here is the sample code I have written below:

const TelegramBot = require('node-telegram-bot-api');

const token = 'YOUR_TELEGRAM_BOT_TOKEN';

const bot = new TelegramBot(token, { polling: true });

bot.on('message', (msg) => {
    const chatId = msg.chat.id;

    if (msg.text && msg.text.toLowerCase() === '/meme') {
        if (msg.reply_to_message && msg.reply_to_message.photo) {
            bot.sendMessage(chatId, 'You have an image');
        }
    }
});

the bot does not reply with any message, if I go into debug mode, the object property “reply_to_message” is always undefined, even though the message replied to the image with the ‘/meme’ command is defined as a message object.

Basketball Scoreboard Javascript is Not Working [closed]

I’m working on my first Javascript project, a basketball scoreboard, and I’m really frustrated.

The 6 buttons to increase the score are not working and I don’t understand why.
I don’t understand what exactly about my JS is not working, I’m tearing my hair out trying to figure out why such a simple project is causing so much trouble.

I would really appreciate any help! Thank you!

let score = 0;

let homeScore = document.getElementById("home-score");

let guestScore = document.getElementById("guest-score");

function homeOne() {
  score = score + 1;
  homeScore.textContent = countHome;
}

function homeTwo() {
  score = score + 2;
  homeScore.textContent = countHome;
}

function homeThree() {
  score = score + 3;
  homeScore.textContent = countHome;
}

function guestOne() {
  score = score + 1;
  guestScore.textContent = countGuest;
}

function guestTwo() {
  score = score + 2;
  guestScore.textContent = countGuest;
}

function guestThree() {
  score = score + 3;
  guestScore.textContent = count;
}
body {
  margin: 0;
}

@font-face {
  font-family: cursed-timer;
  src: url(cursed-timer.ttf);
}

.container {
  margin: 100px auto;
  width: 600px;
  height: 425px;
  background-color: #150400;
  display: flex;
  justify-content: space-evenly;
  border-radius: 2px;
}

h1 {
  margin-top: 75px;
  margin-bottom: 0px;
  color: #ffffff;
  font-size: 48px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 1px;
}

h2 {
  color: #ffa500;
  font-family: cursed-timer;
  font-size: 72px;
  border: 1px solid #ffffff;
  padding: 25px;
  margin-top: 0px;
  margin-bottom: 20px;
  text-align: center;
}

.buttons {
  margin-left: 2px;
  margin-right: 2px;
  padding: 8px;
  font-family: cursed-timer;
  font-size: 20px;
  color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 2px;
  background: none;
  cursor: pointer;
  transition: 0.2s ease-in-out;
}

.buttons:hover {
  border: 1px solid #ffa500;
  background: #ffa500;
  transition: 0.1s ease-in-out;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="stylesheet" href="style.css" />
  <script src="script.js"></script>
  <title>Home</title>
</head>

<body>
  <section class="container">
    <div>
      <h1>HOME</h1>
      <h2 id="home-score">0</h2>
      <button class="buttons" onclick="homeOne()">+1</button>
      <button class="buttons" onclick="homeTwo()">+2</button>
      <button class="buttons" onclick="homeThree()">+3</button>
    </div>

    <div>
      <h1>GUEST</h1>
      <h2 id="guest-score">0</h2>
      <button class="buttons" onclick="guestOne()">+1</button>
      <button class="buttons" onclick="guestTwo()">+2</button>
      <button class="buttons" onclick="guestThree()">+3</button>
    </div>
  </section>
</body>

</html>

Off-canvas menu layout breaks because of canvas on iOS

Like in title, off-canvas menu works fine on pc/android, but z-index has issues on iOS. Do you have any good workaround? WordPress – neve theme, but im mostly styling in css.

text

I tried with sticky positioning, but it’s not working here. I really want to keep that canvas with animation on this site and fix menu displaying. Thanks for help!

Why do I get an Object not found error message when I submit an API request

working on a project in which I am trying to call an API using JavaScript. It is probably just a stupid mistake I am overlooking, but does anyone know why I keep getting this ‘Object not found’ message in the console?

error in browser console

Here is my code, I have an index.js as well a public script.js.

This is my index.js

// import Express library and activate it
import express from "express";
  

const app = express();
// publish our static frontend files
app.use('/',express.static('./public')) 


app.get("/api/ethereum", async (req, res) => {  


        let url = new URL('https://randomuser.me/api/')

    const response = await fetch(url.href)
    const data = await response.json()   


    res.send(data) 
}); 


// Start Express
app.listen(process.env.PORT, () => { 
    console.log(`Express is now Live.`) 
    console.log(`Public URL: `+ process.env.PUBLIC_URL)
}); 

Here is my script.js

const getData = async () =>{
  console.log('Hello from script.js')
  const response = await fetch('/api/ethereum')
  const data = await response.json()
  console.log(data)
}

getData()

To make sure it wasn’t the actual API not working I tried it with a different API, this Random User API that does not require a key. However the same problem occurs… help?

function with 3 if else statements

i am trying to do a if else statement with 3 different if’s and 2 of them have 2 conditions. as far as i know i have it typed out the right way but its giving me a error. here is my code:

function greet(name, time) {
    if (name == "anakin") {
        console.log("Good day, Anakin!")
    }
        else if (name && time === "anakin", "morning") {
        console.log("Good morning and Good day Anakin!")
    }
        else (name && time === "anakin", "evening") {
        console.log("Good evening and Good day Anakin!")
    }
};

greet("anakin, evening");

it is giving me a squiggly red line on the else statement where the opening { is.

i tried switching it to all if statements which works but it runs the second if statement and third if statement no matter what the function is called with i have tried doing a if if else and i get same thing and i have tried putting a ; at the end of each if statement and it still does the same thing

Why is Svelte’s bind:innerHTML retaining an outdated string?

Content is rendering correctly, bind:innerHTML isn’t tracking changes

The content of a div containing two {#each} blocks is bound to a variable via bind:innerHTML. These {#each} blocks are responsive to user input and dynamically render according to variable changes; this is already functional and the component itself displays changes correctly.

However, the variable (svgDivContentString) does not update as the contents of the component change. It simply retains the initial information from when the component was first mounted. No matter how the contents vary, it goes unchanged. Even if it’s emptied manually via svgDivContentString = "", it just resets to the default info when the {#each} block triggers again (regardless of what’s actually being displayed). This string is need for conversion to base64 for use as an img.src.

<div
bind:innerHTML={svgDivContentString}
contenteditable
id="kbContainer"
>
    <svg
    id="svgContainer"
    viewBox="0 0 {$width} {height}"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    >
    {#each allNotes as note, index (index)}
        ...
    {/each}

Attempted solutions/workarounds

I tried emptying the string manually (as seen above) and ensuring that only new information was being introduced, but somehow the same default info ends up in the string every time. I have also tried going a “less Svelte” way and just using document.getElementById on the div, but that returns undefined. It’s also “not very Svelte,” which is often said in response to attempted JS workarounds for Svelte problems on SO posts.

Would like to reiterate that it is not a problem with the {#each} block. The rendered content is correctly updated every time. The problem is that bind:innerHTML isn’t getting that memo for some reason.

Any guidance here or proposals for alternative means to the same end would be greatly appreciated. Apologies if the quality of this question is lacking; I’m still getting my feet wet on SO.

Thank you.

Why is my data-id showing up as null? It’s not being properly passed to Javascript

I have a “quantity” button inside my html that looks like this:

<button class="quantityButton" data-id="{{ card['AssetID'] }}">Quantity</button>

The AssetID is dynamically updated by a local inventory.db.

In Javascript, I’m trying to print the value of data-id through clicking the Quantity button, but it’s showing up as “Null”, no matter what.

What’s confusing is I have a similar “delete” button that looks like this:

<button class="deleteButton" data-id="{{ card['AssetID'] }}">Delete</button>

When I interact with the Delete button, it properly shows the current value of data-id.

Here’s what the JavaScript looks like:

function handleDeleteButtonClick() {
    const assetId = this.getAttribute('data-id');
    console.log(assetId) //This works!
function handleQuantityButtonClick() {
    // Retrieve the asset ID from the button's data attribute
    const assetId = this.getAttribute('data-id');
console.log("Clicked on Quantity, data-id is:", this.getAttribute('data-id'));

I’m confused, is this problem being caused because I’m setting “data-id” twice? Or am I missing something obvious here?

How to sort date and time (newest first) in Javascript?

I know there have been a few questions similar to this but haven’t found a data structure like mine.

My array of objects

const dateAndTime = [
  {
    "createdAt": "20/02/2024, 16:13:51"
  },
  {
    "createdAt": "20/02/2024, 16:15:23"
  },
  {
    "createdAt": "18/02/2024, 14:27:31"
  },
  {
    "createdAt": "18/02/2024, 15:41:06"
  },
  {
    "createdAt": "21/03/2024, 22:09:35"
  },
  {
    "createdAt": "07/03/2024, 17:24:19"
  },
];

Here is the function I built to sort (Newest First)

 dateAndTime.sort((a, b) => {
  const dateA = new Date(a.createdAt);
  const dateB = new Date(b.createdAt);
  return dateB.getTime() - dateA.getTime();
});

console.log(dateAndTime);

OUTPUT

[
  {
    "createdAt": "20/02/2024, 16:13:51"
  },
  {
    "createdAt": "20/02/2024, 16:15:23"
  },
  {
    "createdAt": "18/02/2024, 14:27:31"
  },
  {
    "createdAt": "18/02/2024, 15:41:06"
  },
  {
    "createdAt": "21/03/2024, 22:09:35"
  },
  {
    "createdAt": "07/03/2024, 17:24:19"
  },
]

EXPECTED OUTPUT

[
  {
    "createdAt": "21/03/2024, 22:09:35"
  },
  {
    "createdAt": "07/03/2024, 17:24:19"
  },
  {
    "createdAt": "20/02/2024, 16:15:23"
  },
  {
    "createdAt": "20/02/2024, 16:13:51"
  },
  {
    "createdAt": "18/02/2024, 15:41:06"
  },
  {
    "createdAt": "18/02/2024, 14:27:31"
  },
]

As you can see, the output is pretty much the same, it doesnt seem to be sorting newest first. The expected output is newest first, so the 21st March 2024 10:09:35 PM should be the first object in the array, then it gets older from there.

Where am I going wrong here?

Many thanks in advance!

typeahead.js how to have a more precise search and ignoring special characters (Auto-complete script)

Follow the working demo below on JsFiddle

We have 2 fields, “modulo-1” and “modulo-2”

HTML:

Módulo 1:<br>
<input id="modulo-1" class="typeahead" type="text">
<br>
<br>
Módulo 2:<br>
<input id="modulo-2" class="typeahead" type="text">

<script  type="text/javascript" src="//code.jquery.com/jquery-2.1.0.js"></script>
<script type="text/javascript" src="https://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js"></script>
html {
  overflow-y: scroll;
  *overflow-x: hidden;
}

.container {
  max-width: 750px;
  margin: 0 auto;
  text-align: center;
}

.tt-menu,
.gist {
  text-align: left;
}

/* base styles */
/* ----------- */

html {
  font: normal normal normal 18px/1.2 "Helvetica Neue", Roboto, "Segoe UI", Calibri, sans-serif;
  color: #292f33;
}


a {
  color: #03739c;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.table-of-contents li {
  display: inline-block;
  *display: inline;
  zoom: 1;
}

.table-of-contents li a {
  font-size: 16px;
  color: #999;
}

p + p {
  margin: 30px 0 0 0;
}

/* site theme */
/* ---------- */

.title {
  margin: 20px 0 0 0;
  font-size: 64px;
}

.example {
  padding: 30px 0;
}

.example-name {
  margin: 20px 0;
  font-size: 32px;
}

.demo {
  position: relative;
  *z-index: 1;
  margin: 50px 0;
}

.typeahead,
.tt-query,
.tt-hint {
  width: 396px;
  height: 30px;
  padding: 8px 12px;
  font-size: 24px;
  line-height: 30px;
  border: 2px solid #ccc;
  -webkit-border-radius: 8px;
     -moz-border-radius: 8px;
          border-radius: 8px;
  outline: none;
}

.typeahead {
  background-color: #fff;
}

.typeahead:focus {
  border: 2px solid #0097cf;
}

.tt-query {
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
     -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

.tt-hint {
  color: #999
}

.tt-menu {
  width: 422px;
  margin: 12px 0;
  padding: 8px 0;
  background-color: #fff;
  border: 1px solid #ccc;
  border: 1px solid rgba(0, 0, 0, 0.2);
  -webkit-border-radius: 8px;
     -moz-border-radius: 8px;
          border-radius: 8px;
  -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
     -moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
          box-shadow: 0 5px 10px rgba(0,0,0,.2);
}

.tt-suggestion {
  padding: 3px 20px;
  font-size: 18px;
  line-height: 24px;
}

.tt-suggestion:hover {
  cursor: pointer;
  color: #fff;
  background-color: #0097cf;
}

.tt-suggestion.tt-cursor {
  color: #fff;
  background-color: #0097cf;

}

.tt-suggestion p {
  margin: 0;
}

.gist {
  font-size: 14px;
}

/* example specific styles */
/* ----------------------- */

#custom-templates .empty-message {
  padding: 5px 10px;
 text-align: center;
}

#multiple-datasets .league-name {
  margin: 0 20px 5px 20px;
  padding: 3px 0;
  border-bottom: 1px solid #ccc;
}

#scrollable-dropdown-menu .tt-menu {
  max-height: 150px;
  overflow-y: auto;
}

#rtl-support .tt-menu {
  text-align: right;
}

JavaScript:

// modulo-1
// ----------
var charMap = {
    "à": "a",
    "á": "a",
    "â": "a",
    "é": "e",
    "è": "e",
    "ê": "e",
    "ë": "e",
    "É": "e",
    "ï": "i",
    "î": "i",
    "ô": "o",
    "ö": "o",
    "û": "u",
    "ù": "u",
    "ü": "u",
    "ñ": "n"    
};

var names = ["série:Aladdin", "personagem:Naruto","paródia:Dragon Ball Z"];

var normalize = function (input) {
    $.each(charMap, function (unnormalizedChar, normalizedChar) {
        var regex = new RegExp(unnormalizedChar, 'gi');
        input = input.replace(regex, normalizedChar);
    });
    return input;
};

var queryTokenizer = function (q) {
    var normalized = normalize(q);
    return Bloodhound.tokenizers.whitespace(normalized);
};

var nombres = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
    queryTokenizer: queryTokenizer,
    local: $.map(names, function (name) {
        // Normalize the name - use this for searching
        var normalized = normalize(name);
        return {
            value: normalized,
            // Include the original name - use this for display purposes
            displayValue: name
        };
    })
});

nombres.initialize();

$('#modulo-1').typeahead({
    minLength: 1,
    hint: false,
    highlight: true
}, {
    displayKey: 'displayValue',
    source: nombres.ttAdapter()
});







// modulo-2
// ----------
var substringMatcher = function(strs) {
  return function findMatches(q, cb) {
    var matches, substringRegex;

    // an array that will be populated with substring matches
    matches = [];

    // regex used to determine if a string contains the substring q
    substrRegex = new RegExp(q, 'i');

    // iterate through the pool of strings and for any string that
    // contains the substring q, add it to the matches array
    $.each(strs, function(i, str) {
      if (substrRegex.test(str)) {
        matches.push(str);
      }
    });

    cb(matches);
  };
};

var states = ["série:Aladdin", "personagem:Naruto","paródia:Dragon Ball Z"];

$('#modulo-2').typeahead({
  hint: true,
  highlight: true,
  minLength: 1
},
                         {
  name: 'states',
  source: substringMatcher(states)
});

https://jsfiddle.net/avcurdgy/2/

In module-1, it’s almost the way I want it, in it I can search for “série” or “serie” and it gives me the value I need. But when I search for “naruto” it returns nothing.

Now in “modulo-2” when I search for “naruto” it can find the result, but it doesn’t ignore the accents, if I search for “serie” it doesn’t return anything.

I need that in module-1 when I search for “naruto” it finds the result as in module-2, I tried a lot here for several days, but without success.

Could someone help me?

typeahead.js documentation:
https://twitter.github.io/typeahead.js/examples/

Trying to read a json file

I want to read a json file but i have this issue: ‘node’ is not recognized as an internal or an external command, operable program or batch file

The js file

import { P1 } from './info.json'

console.log(P1)

The JSON file

{
    "P1" : {
        "x" : 0,
        "y" : 0,
        "life" : 3,
        "ang" : 0,
        "shoot" : false
    },
    
    "P2" : {
        "x" : 0,
        "y" : 0,
        "life" : 3,
        "ang" : 0,
        "shoot" : false
    }
}

I tried to use the answer in this article but nothing worked: “https://stackoverflow.com/questions/23412938/node-is-not-recognized-as-an-internal-or-an-external-command-operable-program”

Can someone help?

No me funciona el navigator.clipboard.writeText() en google sites

Estoy programando una web en mi trabajo, bastante básica, cuando la pruebo desde el propio editor de texto me funciona, incluso cuando lo pruebo en un hosting gratuito funciona, pero al momento de subirlo al SITES de google me lanza un error.

** Esperado **
Cuando se dé clic sobre el boton COPIAR!, se debe de copiar en el portapapeles lo que se selecciono y luego se debe de recargar la pagina

Lo que ocurre

lanza los siguientes errores :

Policy violation: The Clipboard API has been blocked because of a permissions policy applied to the current document.

DOMException: Failed to execute ‘writeText’ on ‘Clipboard’: The Clipboard API has been blocked because of a permissions policy applied to the current document.

no se copia el texto y la web no se recarga, solo se queda en blanco.

`

    <fieldset >
        <legend id="field">Tipificacion</legend>

        <div id="CM">

            <p id="pCM">Cliente consulta por 
                <input type="text" id="espe" class="inp" size="15"> <br>
                en <input type="text" id="en" class="inp" size="8"> <br>
                Y se informan  <br> <textarea id="centrosI" cols="50" rows="10" class="inp"></textarea>

            </p>

            <label for="PrescripcionCB">Consulte sobre la preescripcion</label>
            <input type="checkbox" id="PrescripcionCB" class="check" >
            <br>


            <label for="autorizacionCB">Informe sobre la Autorizacion</label>
            <input type="checkbox" id="autorizacionCB" class="check" >
            <br>

            

            <label for="TransferenciaCB">Se transfiere A</label>
            <input type="checkbox" id="TransferenciaCB" class="check">


            <div id="TransA">
                <label for="coberturasCB" class="checkT" >Coberturas</label>
                <input type="radio" id="coberturasCB" class="check" value="C" name="tr"> <br>

                <label for="autorizacionesCB" class="checkT">Autorizaciones</label>
                <input type="radio" id="autorizacionesCB" class="check" value="A" name="tr" > <br>

                <label for="urgenciasCB" class="checkT" >Urgencias</label>
                <input type="radio" id="urgenciasCB" class="check"  value="U" name="tr"> <br>

                <label for="inglésCB" class="checkT">Inglés</label>
                <input type="radio" id="inglésCB" class="check" value="I" name="tr"> <br>


            </div>






        </div>

        



    </fieldset>

    <br>

    <div id="copiarC" >
        <button id="copiar" onclick="copiar()">Copiar!</button>
    </div>

    

</div>`

`function copiar(){

var texto = "Cliente consulta por " + document.getElementById('espe').value + " En " +  document.getElementById('en').value +" Y se informan "+ document.getElementById('centrosI').value;




if(document.getElementById('autorizacionCB').checked){

    texto = texto + " E informe acerca de la autorizacion"
    
}

if(document.getElementById('PrescripcionCB').checked){

    texto = texto + ", Consulte sobre el volante"
    
}
if(document.getElementById('coberturasCB').checked){
    texto = texto + ", Se transfiere a coberturas"
}
if(document.getElementById('autorizacionesCB').checked){
    texto = texto + ", Se transfiere a Autorizaciones"
}
if(document.getElementById('urgenciasCB').checked){
    texto = texto + ", Se transfiere a Urgencias"
}
if(document.getElementById('inglésCB').checked){
    texto = texto + ", Se transfiere a Inglés"
}

// copiar

navigator.clipboard.writeText(texto);

location.reload();

}`

Cabe recalcar nuevamente que el error solo pasa en google sites, ya active los permisos de portapapeles y me sale el mismo error

Inconsistent state in nested react component

So I have a container component that can expand to fit some content, and it should also expand when nested containers are expanded.

the component:

export default function ExpandableContainer({expanded , children}) {

const ref = useRef(0)

const [style, setStyle] = useState({"maxHeight": 0})

useEffect(() => {
    setStyle(expanded ? {'maxHeight':ref.current.children[0].getBoundingClientRect().height} : {'maxHeight':0})
},[expanded,children])

return (
    <div ref={ref} style={style} className='xxx'>
        <div>
            {children}
        </div>
    </div>
)
}

what im trying to make:

export default function Grandparent({expanded}) {

const [childExpanded, setChildExpanded] = useState(false)

return (

<ExpandableContainer expanded={expanded}>

  <div>

    <button onClick={() => setChildExpanded(!childExpanded)}>
      //some stuff
    </button>

  </div>

  <ExpandableContainer expanded={childExpanded}>

      //some stuff

  </ExpandableContainer>


</ExpandableContainer>
)
}

this works perfectly fine with the parent component, it expands and closes to the correct size. but on the child component, with the parent open, clicking to open the child does not affect the size of the parent, but the childs size is correct. clicking the button again to close the child makes the parent take the size that it should be when the child is open.

initial

parent, props - expanded:false , state {maxHeight:0}
child, props - expanded:false , state {maxHeight:0}

parent open button clicked:

parent, props - expanded:true, state {maxHeight:77}
child, props - expanded:false , state {maxHeight:0}

child open button clicked:

parent, props - expanded:true, state {maxHeight:77}  <- should be 355
child, props - expanded:true, state {maxHeight:278}

child close button clicked:

parent, props - expanded:true, state {maxHeight:355} <- should be 77
child, props - expanded:false , state {maxHeight:0}

being new to react I have a feeling that this has to do with some stale state somewhere or with using ref incorrectly but I cant see where. any help would be appreciated

Edit: after some more looking, a potential change was changing setChildExpanded(!childExpanded) to setChildExpanded((prev) => !prev), this had no effect on the problem however

Update the url and parts of the page with the filter output without reloading the page

there is a page https://www.expertproperty.ru/kvartiry-v-alanii/ to it I pass get property_country[]=turcziya&property_city[]=nedvizhimost-alaniya&type[]=kvartiry without reloading the page for the filter to work and select the necessary parameters using script, and in the same script within the session I update it again but with a reboot so that the get parameters work and the selected objects by filter appear

here is the script

`<script>
document.addEventListener("DOMContentLoaded", function() {
     // Get the current page URL
     var currentUrl = window.location.href;

     // Add the necessary GET parameters
     var newParams = 'property_country[]=turcziya&property_city[]=nedvizhimost-alaniya&type[]=kvartiry';

     // Update the page URL with new GET parameters without redirecting
     window.history.replaceState({}, '', currentUrl + '' + newParams);

var reload = sessionStorage.getItem('reload');
if(!reload){
     sessionStorage.setItem('reload', 1);
     window.location.reload();
}

});
</script>`

how can I make sure that get parameters are added and without refreshing the page they are applied and the filter area is updated without reloading the page - I heard that Ajax can do this
help me understand the problem. for SEO you need to stay within the url https://www.expertproperty.ru/kvartiry-v-alanii/ with a response of 200 when loading the page, and in the implementation that is now https://www.expertproperty.ru/kvartiry-v -alanii/property_country[]=turcziya&property_city[]=nedvizhimost-alaniya&type[]=kvartiry gives the answer 200 as if this is a redirect

how can I make sure that get parameters are added and without refreshing the page they are applied and the filter area is updated without reloading the page – I heard that Ajax can do this
help me understand the problem. for SEO you need to stay within the url https://www.expertproperty.ru/kvartiry-v-alanii/ with a response of 200 when loading the page, and in the implementation that is now https://www.expertproperty.ru/kvartiry-v -alanii/property_country[]=turcziya&property_city[]=nedvizhimost-alaniya&type[]=kvartiry gives the answer 200 as if this is a redirect

Why don’t run at multiple thread?

const express=require("express");
const app=express();
const cluster=require('cluster');
const os=require('os');

function delay(duration){
    const start=Date.now();
    while(Date.now()-start<duration){

    }
}

app.get('/',(req,res)=>{
    res.status(200).send(`request running at id ${process.pid}`)
})


app.get('/timer',(req,res)=>{
    delay(5000)
    res.status(200).send(`Timer running at id ${process.pid}`)
})



if(cluster.isPrimary){
    console.log(`Master running...`)
    const NUM_WORKERS=os.cpus().length
    for(let i=0;i<NUM_WORKERS;i++){
        cluster.fork()
    }
}
else if (cluster){
    console.log(`Fork running at ${process.pid}`)
    app.listen(8000,()=>{
        console.log(`Server is running at port ${8000}`)
    })
}


why they are running at the same pid, thread ? When I make request with get / and /timer they should run at different thread. I tried chatGPT Devin but nothing…

div with flex display spacing between inputs

I’m trying to use Flex to have a div that has inputs and I wanted it to occupy the entire center of the screen with space between the inputs without needing to use margin bottom to have space between them, I thought this code was enough, but they There is no space between them. Is it possible to do this with CSS without using margin-bottom in the inputs?

.flex {
  display: flex;
}

.flex-1 {
    flex: 1 1 0%;
}

.flex-col {
    flex-direction: column;
}

.justify-center {
    justify-content: center;
}
<div class="flex flex-1 flex-col space-between">
  <div class="flex justify-center">
    <div class="flex items-center">
        banner
    </div>
  </div>
  <div class="flex justify-center">
    <div class="flex flex-col space-between">
      <input type="text" placeholder="Nome" name="nome"/>
      <input type="text" placeholder="Nome" name="nome"/>
      <input type="text" placeholder="Nome" name="nome"/>
      <input type="text" placeholder="Nome" name="nome"/>
      <input type="text" placeholder="Nome" name="nome"/>
      <input type="text" placeholder="Nome" name="nome"/>
     </div>
  </div>
  <div class="flex justify-center">
      <button type="button">Click Me!</button>
  </div>
</div>

basically I wanted to have spacing between the inputs and the button and the header.