



We then render our example pug file.ģ) In our pug file we have two headers, one that prints our prompt ('Hello World!') and the other prints the value secret which was defined in our first middleware function. In this function we print to the console the value which was defined in our middleware function. The function then calls the next() method telling express we're ready to move to the next middleware function, in this case our anonymous function.Ģ) After the first middleware function completes ( next() ) our anonymous function gets called. 1) We define a middleware function called 'middleware' which assigns the value 'SuperSecret' to the secret property of the res.locals object.
