How could we map some path to another path using the node.js connect middleware?
For example, I'd like my server to respond with fileA when requested for fileB.
(it's for using inside grunt-contrib-connect)
I have one stupid method, but it's a method !
copy: {
"mount-server": {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: './.mount-server/search/mobileqq/',
src: [
'**/**'
]
}]
}
}
connect: {
options: {
port: 80,
// change this to '0.0.0.0' to access the server from outside
hostname: null
},
livereload: {
options: {
middleware: function (connect, options) {
return [
lrSnippet,
mountFolder(connect, '.tmp'),
mountFolder(connect, "./.mount-server/")
];
}
}
}
}
grunt.registerTask('prepareServer', [
"clean:mount-server",
"copy:mount-server"
]);
grunt.registerTask('server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
}
grunt.task.run([
'concurrent:server',
"prepareServer",
'connect:livereload',
'open:server',
'watch'
]);
});
just copy your file and make another mount folder !