1. Create the project folder my_ejs.
2. First use npm install express and npm install ejs
Download these two guys. As for whether to set it globally, I habitually download it to the folder in this project my_ejs.
Then create the corresponding file:
index.js:
form.ejs:
index.ejs
app.js:
Start running app.js
node app.js, and then access the browser side: localhost:1337
Click to publish the article:
Click Post and jump to the homepage.
Well, until now, a simple "website" has come out.
I sincerely complained: It is really too difficult to learn express+ejs. When I got a book and hit it on it, I couldn’t get the expected results. It took me a long time to find out that express+ejs has been changing, and the only authoritative one is the official website, but the official website doesn’t say much, and they are all in English and I can’t understand it at all.
Have you guys gained a new understanding of node+express+ejs? To be honest, I am not very good at it. I have always been feeling the stones across the river. This article is just for you to refer to.