var express = require('express'); var app = express(); // log requests app.use(express.logger('dev')); app.use(express.static(__dirname + '/public')); app.listen(1024); console.log('Listening on port 1024');
使用http://localhost:1024/css/style.css就可以读取/public/css/style.css文件了