Javascript HAPI js服务器-禁止(静态文件)
我需要以以下方式返回子目录中的图像:Javascript HAPI js服务器-禁止(静态文件),javascript,api,file,static,hapi,Javascript,Api,File,Static,Hapi,我需要以以下方式返回子目录中的图像: server.route({ method: 'GET', path: '/images/{file_path}/{file}', handler: (request, h) => { console.log(Path.join(__dirname, '/data/images')); console.log(`/${request.params.file_path}/${request.para
server.route({
method: 'GET',
path: '/images/{file_path}/{file}',
handler: (request, h) => {
console.log(Path.join(__dirname, '/data/images'));
console.log(`/${request.params.file_path}/${request.params.file}`);
return h.file(`/${request.params.file_path}/${request.params.file}`);
}
});
但Hapi将403返回给客户。有人能帮忙吗
{
"statusCode": 403,
"error": "Forbidden",
"message": "Forbidden"
}