Home  >  Article  >  Web Front-end  >  A guide to getting started with making simple pages using node express ejs_node.js

A guide to getting started with making simple pages using node express ejs_node.js

WBOY
WBOYOriginal
2016-05-16 16:30:211350browse

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, depending on your habits, I habitually download it 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 it on the browser: localhost:1337

Click to publish an article:

Click to post and jump to the homepage.

That’s it, a simple “website” is finally here.

A sincere complaint: It is really too difficult to learn express ejs. I got a book and typed on it, but I couldn’t get the expected results. It took me a long time to realize that express ejs has been changing and is the only authoritative one. It’s the official website, but there’s not much on the official website, and it’s all in English, so 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 been crossing the river by feeling the stones. This article is just for everyone's reference.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn