问题描述
我想运行index.html文件,该文件是通过使用Node.js服务中的Angular构建制作的
server.route({
method:'GET',path:'/home',handler:(req,res) =>{
return res.file('public/index.html')
}
});
文件的关联如下,
Project Folder
├───index.js
├───package.json
├───package-lock.json
├───public
├───index.html
├───assets
{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}
Server running on http://localhost:3000
Debug: internal,implementation,error
TypeError: res.file is not a function
at handler (D:\API\index.js:40:16)
at exports.Manager.execute (D:\API\node_modules\@hapi\hapi\lib\toolkit.js:60:33)
at Object.internals.handler (D:\API\node_modules\@hapi\hapi\lib\handler.js:46:48)
at exports.execute (D:\API\node_modules\@hapi\hapi\lib\handler.js:31:36)
at Request._lifecycle (D:\API\node_modules\@hapi\hapi\lib\request.js:365:68)
at processticksAndRejections (internal/process/task_queues.js:97:5)
at async Request._execute (D:\API\node_modules\@hapi\hapi\lib\request.js:274:9)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)