Node + express + ejs simple page Getting Started Guide, ejs Getting Started Guide
1. Create the project folder my_ejs.
2. Use npm install express and npm install ejs
Download these two guys. As for whether or not to set them to global, I am used to downloading them to the folder my_ejs in this project.
Then create the corresponding file:
Index. js:
Form. ejs:
Index. ejs
App. js:
Start running app. js
Node app. js, and then access: localhost: 1337 on the browser side
Click post:
Click "Post" to go to the homepage.
So far, a simple "website" is ready.
I sincerely complained that it was too difficult to learn express + ejs. When I got a book and tried to get the expected results, I learned that express + ejs has been changing for a long time, the only authority is the official website, but there are not many official websites mentioned above, and they are all in English and cannot be understood at all.
Are you new to node + express + ejs. To tell the truth, I am not a good expert. I have been crossing the river by feeling the stones. This article is just for your reference.