I am following this video to create a simple server in NodeJS (v16.19.0) and ExpressJS (v4.18.2).
app.js
const express = require("express");
const app = express();
// Middleware
const middleware = (req, res, next) => {
console.log(`Hello my middleware`);
next(); //error on this line: next is not a function
}
middleware();
app.get("/", (req, res) => {
res.send(`Hello world from server`);
});
app.listen(3000, () => {
console.log("server runnin at port 3000");
});
error: next is not a function, when I run app.js. How do I solve this