1.0.10 • Published 7 years ago
response-static v1.0.10
使用方式
npm install response-static
var responseRes = require('response-static');
var http = require('http');
var path = require('path');
var cwd = process.cwd();
var server = http.createServer(function(req,res){
// 静态资源的位置
var filePath = path.join(cwd,'dist',req.url);
// 响应请求
responseRes(filePath,res);
});
server.listen(9002,()=>{
console.log('静态资源监听');
});