var express = require('express');
var app = express();
app.get('/',function(req,res){
res.redirect('/admin');
});
app.get('/admin',function(req,res){
res.send('欢迎管理员');
});
app.listen(3000);
当我们访问:http://localhost:3000/时将自动调整到http://localhost:3000/admin
如果需要详细设置,可通过res.hostname来进行判断:http://localhost的host为localhost

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2021-07-02
  • 2021-04-12
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2021-10-03
  • 2022-03-10
  • 2021-11-19
相关资源
相似解决方案