----- TestEjs2 Example -------------------------- // TestEjs2 Example // Source code file: main.js // Pass local variable name to ejs page. const express = require("express"); const app = express( ); app.set("view engine", "ejs"); app.get("/", (q, r) => { r.render("page", {name: "Alice"}); }); app.listen(3000, ( ) => { console.log("Listening on port 3000."); }); -------------------------------------------------
Hello, <%= name %>, how are you?
-------------------------------------------------