我正在使用Polymer与NodeJs / Express服务器结合使用,我计划使用Firebase功能进行托管 .

我的问题是除了index.html之外,没有找到任何内部文件(404) . 没有他们我会反复在我的索引文件中进行的第一次导入 . (webcomponents-loader.js和my-app.html)

我尝试了很多不同的口味 . 从绝对路径,带有基本标记,没有和具有不同的目录结构 . 对于node.js或者表达我显然不是专家,所以我相信我做的事情从根本上是错误的 .

Update
无法找到的链接具有与为index.html提供服务的路径不同的URL
404:http://localhost:5000/src/my-app.html
指数:http://localhost:5000/nodefire-96b46/us-central1/serve

My directory:

  • fire_node

  • 功能

  • node_modules

  • index.js

  • build

  • 现代

  • bower_components

  • index.html

  • polymer.json

  • src

  • 我的应用程序

My server file

const express = require('express');
const app = express();

app.use(express.static(__dirname + '/build/modern'));

app.get('/', (req, res) => { 
  res.sendFile("index.html", {root: '.'});
});

app.listen(2000, () => {
  console.log('Server is listening on port 2000');
});

My index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
    <title>My App</title>
    <base href="/modern/">
    <link rel="manifest" href="manifest.json">
    <script>
      window.Polymer = { rootPath: '/' };
    </script>
    <script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>
    <link rel="import" href="http://localhost:4000/fire_node/functions/build/modern/src/my-app.html">
  </head>

  <body>
    <my-app></my-app>
    <noscript>
      Please enable JavaScript to view this website..
    </noscript>
  </body>

</html>