You can have the server do some work after receiving parameters from the frontend.
The javascript loaded in the DOM will send a request to the server, the server will do some work, unknown to the frontend JS, then return the result.
On Server:
app.post('/path', (req, res) => {
const json = req.body;
//do work
const resp = {some: 'data'};
res.json(resp);
}
On Frontend
fetch('/path', {
method: 'post',
body: JSON.stringify(data),
headers: { 'Content-type': 'application/json' }
})
.then(res => res.json()) // get json data out of response object
.then(json = > {
// do something with response json
}
You'll want to do some reading on Express and body parsing, as well as using parameters in GET requests as opposed to body
in POST requests, also other types of requests.