小编use*_*354的帖子

heroku节点应用程序在空闲后退出

我有一个在heroku上托管的节点应用程序.工作正常,但是一旦应用程序在30分钟后开始空闲,应用程序将从上到下更改,并以状态0退出.

2016-08-16T00:02:28.554960+00:00 heroku[web.1]: State changed from starting to up
    2016-08-16T00:35:02.601620+00:00 heroku[web.1]: Idling
    2016-08-16T00:35:02.602105+00:00 heroku[web.1]: State changed from up to down
    2016-08-16T00:35:05.902125+00:00 heroku[web.1]: Stopping all processes with SIGTERM
    2016-08-16T00:35:06.827968+00:00 heroku[web.1]: Process exited with status 0
Run Code Online (Sandbox Code Playgroud)

它可能是代码中的东西,还是我只是需要让它免于闲置?

谢谢!保罗

heroku node.js

6
推荐指数
1
解决办法
1712
查看次数

如何使用Mandrill将csv文件附加到电子邮件?

我有一个csv字符串,我试图作为电子邮件中的附件发送,但内容是胡言乱语.这是一个节点脚本.有任何想法吗?

                 // csv is a csv string

                 var message = {
                    "html": msg,
                    "subject": 'Test CSV Attachment',
                    "from_email": from,
                    "from_name": "Tester",
                    "to": [{
                            "email": email
                            }],
                    "headers": {
                        "Reply-To": email
                    },
                    "attachments": [{
                        "type": 'text/csv',
                        "name": filename,
                        "content": csv
                    }],
                  };

                    mandrill_client.messages.send({"message": message}, function(result) {
                    console.log('result NOTIFICATION! ', result);
                  });
Run Code Online (Sandbox Code Playgroud)

node.js mandrill

3
推荐指数
1
解决办法
985
查看次数

如何在部署在 Elastic Beanstalk 上的 Express 服务器上创建“Access-Control-Allow-Origin”标头?

我将 Express 服务器部署到 Elastic Beanstalk,但我无法让它访问外部域!我觉得我已经尝试了许多应该有效的方法。请看一看,如果我遗漏了什么,请告诉我。提前致谢!

  1. 在快速配置中添加标头

    var app = express();

    app.use(function (req, res, next) {

    // Website you wish to allow to connect
    res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8100');
    
    // Request methods you wish to allow
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    
    // Request headers you wish to allow
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
    
    // Set to true if you need the website to include cookies in the requests sent
    // to the API (e.g. in case you use sessions)
    res.setHeader('Access-Control-Allow-Credentials', true);
    
    // Pass to next …
    Run Code Online (Sandbox Code Playgroud)

express amazon-elastic-beanstalk

0
推荐指数
1
解决办法
2389
查看次数