EJS non viene visualizzato nel file html

Viewed 14

I am planning a site where all the pages are in html and two of these the composition page and the general page are in ejs format. I'm having trouble viewing the ejs files can anyone help me?

app.set('view engine', 'ejs');

app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static(path.join(__dirname, 'public' )));

let posts= []; 

app.get("/general", function(req, res){

    res.render("general", {

       posts:posts 
    });

});


app.post("/compose", function(req, res){

    let post= {

        title:req.body.postTitle,
        content:req.body.postText,
        file:req.body.postFile
       
    }

    res.redirect("/general");
});
0 Answers
Related