I'm attempting to use multiple static directories. You can use the example shown in the documentation, it will fail.
It attempts to make the DIR but doesn't check if it's an object, instead expects a string.
This will work.
www: path.resolve(__dirname, '..', 'static')
This will not.
www: [
{
path: path.resolve(__dirname, '..', 'static'),
humanUrl: '/admin'
},
{
path: path.resolve(__dirname, '..', 'uploads', 'pictures', 'cats'),
humanUrl: '/cats'
}
]
This will eventually get to trailpack-core (line 46)
// create paths if they don't exist
return Promise.all(Object.keys(paths).map(pathName => {
const dir = paths[pathName]
try {
const stats = fs.statSync(dir)
if (!stats.isDirectory()) {
this.log.error('The path "', pathName, '" is not a directory.')
this.log.error('config.main.paths should only contain paths to directories')
return Promise.reject()
}
}
catch (e) {
fs.mkdirSync(dir)
}
}))
}
And dir will be the object, not the string. Thus, an error will be thrown killing the server.
I'm attempting to use multiple static directories. You can use the example shown in the documentation, it will fail.
It attempts to make the DIR but doesn't check if it's an object, instead expects a string.
This will work.
www: path.resolve(__dirname, '..', 'static')This will not.
This will eventually get to
trailpack-core(line 46)And
dirwill be the object, not the string. Thus, an error will be thrown killing the server.