nodejs

app.engine('html', require('ejs').__express);//html模板需要引进
app.set('view engine',"html");
app.set("views ", __dirname + '/views');

app.get("/",function(req,res){
    res.render("index.html",{name:"guanhb"})
})
  //app.use(require('../routes/route'))
  app.get('/class',function(req,res){
      res.status(200);
      res.json({
          python:20,
          nodejs:1,
          other:10
      })
  })
  app.listen(3000);
原文地址:https://www.cnblogs.com/guanguan-/p/8127602.html