日志告诉我没有提供图标
"GET /favicon.ico" 502
的app.yaml
runtime: nodejs
env: flex
server.js
const Hapi = require('hapi');
const Vision = require('vision');
const Inert = require('inert');
const Path = require('path');
const Handlebars = require('handlebars');
async function start() {
const server = new Hapi.Server({ host: 'localhost', port: process.env.PORT || 8080 });
await server.register([Inert, Vision]);
server.views({ engines: { html: Handlebars }, path: `${__dirname}/templates` });
const rootHandler = (request, h) => {
return h.view('index', {
title: "Data Controller",
message: "All hail the DC Dashboard",
meta: `Hapi ${request.server.version}`
});
};
server.route({ method: 'GET', path: '/', handler: rootHandler });
server.route({ method: 'GET', path: '/{param*}', handler: { directory: { path: `${__dirname}/public` }}});
server.route({ method: 'GET', path: '/favicon.ico', handler: { file: `${__dirname}/public/favicon.ico` }, config: { cache: { expiresIn: 86400000 }}});
try {
await server.start();
}
catch (err) {
console.log(err);
process.exit(1);
}
console.log('Server running at:', server.info.uri);
};
start();
文件夹结构:
/
- public
- css
- js
favicon.ico
server.js
我只是不确定如何解决这个问题!任何帮助表示赞赏。
答案 0 :(得分:1)
好吧我通过将主机设置为
解决了这个问题0.0.0.0