遇到express.static()方法, 但是有点不懂它到底是怎么用的.
思考到的一个问题是,访问一个网站的时候,例如www.test.com,他是怎么把url改成www.test.com/index.html的?
给一下我的认为的代码吧(一个大致的框架而已)
app.get('/',function(req,res) {
// 怎么把url改成是访问www.test.com/index.html呢?
// 这个问题应该不是用express.static()来解决吧?
});
The default index.html, otherwise why do you think the homepage is named this? Express seems to be its own web server, and you can access index silently
If you are using express, after creating a template with express, there will be an index.js file in the /router directory. The code inside defines the default page after accessing www.example.com/. The code is as follows
'index' is a template, go to the /views folder to check it out.