2

我想创建一个文件,然后使用 Meteor 提供它,但是当我在公共目录中创建/更新文件时,我不希望服务器重新启动。

用户将单击一个按钮在服务器上创建一个配置文件,我希望用户能够下载该配置文件。

有没有办法在不触发服务器重启的情况下做到这一点?

我尝试创建文件链接并创建隐藏文件,但没有任何效果。

谢谢你的时间。

4

3 回答 3

3

试试meteor run --production。那可能会解决你的问题。

于 2012-07-08T06:46:39.453 回答
0

If you doesn't want to run in production mode, here is a workaround:

  1. In order to prevent reloading, you have to generate your files in a folder that is located outside of your project's repository.
  2. Then you will have your meteor app to serve the content of that folder.

Here is an example that uses the connect npm repository to make your local folder /meteor/generated_files served under the url hostname.com/downloads/:

var connect = Npm.require('connect');
var fs = Npm.require('fs');

function serveFolder(urlPath, diskPath){
    if(!fs.existsSync(diskPath))
        return false;
    RoutePolicy.declare(urlPath, 'network');
    WebApp.connectHandlers.use(urlPath, connect.static(diskPath));
    return true;
}

serveFolder('/downloads', '/meteor/generated_files/');

I published the very primitive package I have that does just that.

于 2014-03-22T12:29:42.907 回答
0

服务器重新启动是因为您在开发模式下运行它,当它在生产中运行时,它不会在内容更改时重新启动。

要在生产中运行,我知道的唯一方法是,在捆绑应用程序后,
请看这里:http ://docs.meteor.com/#deploying

于 2012-07-06T09:26:14.747 回答