node / static routing / express frame express.static () and app.use ()

This article is reproduced in 

express frame express.static () and app.use ()

Express incoming frame when express.static static routing, all the files in this folder will become the folders and files in use app.use routing file, that is when the input path in the URL, will be captured directly to the request.

When using express framework, we will meet to set a static file directory, as follows

// static Wenjin ah directory is set to: Project root directory + / public 
app.use (express.static (__ dirname + "/ public" ))
app.use(express.static(path.join(__dirname,"public")))

Guess you like

Origin www.cnblogs.com/-constructor/p/11818827.html