我的代码很简单,而 grunt 文件是,
module.exports = function(grunt) {
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
grunt.initConfig({
connect: {
server: {
options: {
hostname: "localhost",
keepalive: true,
base:['../web/'],
port: 8080,
middleware: function(connect, options) {
return [proxySnippet];
},
debug: true
}
}
}
});
// grunt.loadNpmTasks('grunt-connect-proxy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('default', [
'connect:server'
]);
};
有一个 index.html,路径是“../web/index.html”。当我打开
"http://localhost:8080"
它给出“无法获取 /”。知道为什么会这样吗?