How can I implement virtual directories with node.js and express?

前端 未结 2 1992
日久生厌
日久生厌 2021-01-12 04:07

I want to use the express static server configuration for implementing an static server:

app.configure(function() {
    app.use(express.static(__dirname + \'         


        
2条回答
  •  囚心锁ツ
    2021-01-12 04:27

    This should work for you:

    var serveStatic = require( "serve-static" );
    app.use('/url1', serveStatic('c:\\dirA\\dirB'));
    app.use('/url2', serveStatic('C:\\dirC'));
    

    Take a look at the documentation for app.use().

提交回复
热议问题