码迷,mamicode.com
首页 > 其他好文 > 详细

sails中创建和使用services

时间:2015-12-18 21:08:00      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:

从sails官方在线文档查知

// EmailService.js - in api/services
module.exports = {

    sendInviteEmail: function(options) {

        var opts = {"type":"messages","call":"send","message":
            {
                "subject": "YourIn!",
                "from_email": "info@balderdash.co",
                "from_name": "AmazingStartupApp",
                "to":[
                    {"email": options.email, "name": options.name}
                ],
                "text": "Dear "+options.name+",\nYou‘re in the Beta! Click <insert link> to verify your account"
            }
        };

        myEmailSendingLibrary.send(opts);

    }
};

//You can then use EmailService anywhere in your app:
// Somewhere in a controller
  EmailService.sendInviteEmail({email: ‘test@test.com‘, name: ‘test‘});

 

sails中创建和使用services

标签:

原文地址:http://www.cnblogs.com/wod-Y/p/5057893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!