node+express build a personal website (2)

node+express build a personal website (1) In this section, a website was successfully started, but it was still very simple, and only a helloworld webpage was printed.

As a personal website, of course we want to output the webpage we designed,

we use

Express App Builder

Generate a prototype of a website

I generally use ejs templates, all the time

express myapp -e

makefile directory

├── app.js
├── bin
│ └── www // startup file
├── package.json
├── public // static resources
│   ├── images
│   ├── javascripts
│   └── stylesheets
│       └── style.css
├── routes // route jump file
│   ├── index.js
│   └── users.js
└── views // view file
    ├── error.ejs
    └── index.ejs

 

start up

cd myapp
npm install
set DEBUG=myapp & npm start

 http://localhost:3000/

You can see welcome to express 

We can modify the page style we want in index.ejs

Of course, if we want to smoothly generate the website we want, we still need to understand

Host static files with Express

http://www.expressjs.com.cn/starter/static-files.html

Specify the access location of referenced resources, such as css js images, etc.

A simple Express route

http://www.expressjs.com.cn/starter/basic-routing.html

For creating simple address jumps

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324663078&siteId=291194637