简体   繁体   中英

How to set root folder for grunt-express?

I need to set my web root folder one directory up from where my static files are located. Its a long story as to why this is needed !

Here is a snipped of my grunt js file

// The actual grunt server settings
    express: {
        all : {
            options : {
                hostname: 'localhost',
                port:9000,
                bases: ('../DirectoryAbove')
            }
        }
    }

Any help would be appreciated

Have you tried using an absolute path instead?

express: {
    all : {
        options : {
            hostname: 'localhost',
            port:9000,
            bases: path.resolve(__dirname, '../DirectoryAbove')
        }
    }
}

The bases option is an array of strings. Use that instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM