我有以下代码:
var express = require('express'),
app = express();
app.use(express.static(__dirname + '/static'));
app.get('/', function(req, res) {
//???
});
app.listen(80);
首先如何执行该功能然后发送静态文件?
现在只发送一个静态文件。
答案 0 :(得分:0)
var express = require('express'),
app = express();
app.use(app.router); //<------------this way
app.use(express.static(__dirname + '/static'));
app.get('/', function(req, res, next) {
//actions
//send index
next();
});
app.listen(80);