Express calls next ();

function a(){
    var a1 = "Hello World!";
    next();
}

app.get("/b", a, function (req, res) {
  res.send(a1);
});

how should I get the A1 variable in the previous method;

Mar.04,2021

function a(){
    var a1 = 'Hello World!';
    next(a1);
}

app.get('/b', a, function (a1, req, res) {
  res.send(a1);
});
Menu