Meteor.js:是否可以更改 URL 中的基本路径?

Meteor.js: Is it possible to change the base path in the URL?

我想使用 URL http://localhost:3000/theapp 而不是 http://localhost:3000/ 访问整个应用程序。

在使用 meteor build 构建的应用程序的 html 源代码中:

<html>
<head>
  <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/8b140b84a4d3a2c1d8f5ea63435df8afc22985aa.css?meteor_css_resource=true">
  <script src="/215e9bb1458d81c946c277ecc778bae4fc8eb569.js">
...

我想将基本路径从 / 更改为 /theapp,因此上面的 <link><script> 标记将变为:

  <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/theapp/8b140b84a4d3a2c1d8f5ea63435df8afc22985aa.css?meteor_css_resource=true">
  <script src="/theapp/215e9bb1458d81c946c277ecc778bae4fc8eb569.js">

这个要求的原因是我试图使用 Nginx 根据 URL:

中的路径将请求转发到不同的流星应用程序
http://localhost/app1  ==> http://meteor-app1
http://localhost/app2  ==> http://meteor-app2

这可能吗?

所以正如@d4nyll 在评论中提到的,我需要做服务器级路由而不是应用程序级路由。 Iron Router / Flow Router 等解决方案将不起作用。

在这里找到答案:http://docs.meteor.com/#/full/meteor_absoluteurl

基本上只需要设置环境变量即可:ROOT_URL.