`
sillycat
  • 浏览: 2550994 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Parse and Heroku Service(2)Mail Templates and Push Notification

 
阅读更多
Parse and Heroku Service(2)Mail Templates and Push Notification

1 Sample Project for Parse Cloud
Parse Account Key
> parse configure accountkey

enter to open the key generate page.

The key is stored in local
> cat ~/.parse/netrc
machine api.parse.com#luohuazju@gmail.com
login default
password xxxxxxxxxxxxx


machine api.parse.com
login default
password xxxxxxxxxxxxx


Link Parse to Heroku
> parse new

existing —> Heroku

Following this document
https://www.parse.com/docs/cloudcode/guide#command-line

It will create an empty parse hello world project for us.

Project Structure
cloud/main.js will the place for cloud codes.

Deploy the cloud and public directories to Parse.com
> parse deploy

Then we can visit the static content here.
https://parsesample-3izxfd-1382.herokuapp.com/

2 Understand Some Codes

Define the function on the cloud
Parse.Cloud.define("hello", function(request, response) {
  console.log('Ran cloud function.');
  response.success("Hello world! " + (request.params.a + request.params.b));
});

Then we call functions from SDK(Android and iOS), PHP, .NET SDK, Javascript SDK, REST API

A lot of parse.com SDK command to debugging, logging and etc.

Command Line Tool with Heroku
…snip...

3 Read More Code Examples
Email Templates
We should Generate the Template Once, and Render the different users, orders, products times.
Email-templates from https://github.com/niftylettuce/node-email-templates

Cloud Code Request
  Parse.Cloud.httpRequest({
    method: 'POST',
    url: url,
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': AMAZON_GATEWAY_KEY
    },
    body: JSON.stringify(data)
  }).then(function(httpResponse) {
    console.log(httpResponse.text);
    var result = JSON.parse(httpResponse.text);
    if (result['status'] === 'Fail') {
      response.error('Request failed with message ' + httpResponse.text);
    } else {
      response.success(httpResponse.text);
    }
  }, function(httpResponse) {
    console.error('Request failed with response code ' + httpResponse.status);
    response.error('Request failed with response code ' + httpResponse.status);
  });

Push Message
    Parse.Push.send({
    channels: ["global"],
      data: {
         alert: "We found a new job for you!"
      }
    });

AngularJS 1.4.9
Parse.com JS SDK 1.6.14 (Parse SDK provide SDK to deal with RestClients and a lot of .)

References:
http://sillycat.iteye.com/admin/blogs/2284695

https://www.parse.com/docs/cloudcode/guide#command-line
分享到:
评论

相关推荐

    Parse中的Push Notification在Android中的应用

    在本文中,我们将深入探讨Parse在Android中的Push Notification应用。 首先,我们需要理解Parse Push Notification的工作原理。Parse服务器会存储用户的设备Token,这是Android系统为每个应用程序分配的一个唯一...

    Beginning App Development with Parse and PhoneGap 无水印pdf 0分

    Using Facebook’s Parse as backend service, and Adobe’s PhoneGap (or Cordova) as a mobile development framework, building a highly customizable application is easier than you can imagine. A basic ...

    Android Push Notification客户端源码包

    在Android开发中,Push Notification是一种重要的技术,它允许应用程序在后台接收来自服务器的消息,并在用户的通知栏中显示这些消息,即使应用并未运行。这个"Android Push Notification客户端源码包"显然是一个...

    前端开源库-parse5-htmlparser2-tree-adapter

    在`parse5-master`这个压缩包中,很可能包含了parse5库的源码和相关资源,你可以通过阅读源码、查看示例和文档来更深入地理解这个库的工作原理,以及如何有效地使用`parse5-htmlparser2-tree-adapter`。同时,熟悉这...

    Android代码-一个很好用的通知栏推送(Convert JSON to Android Notification)

    json2notification Contributors.. ...Convert JSON to Android Notification. This is very useful for push notification (GCM). ...Integration of Parse push notification public SimplePa

    实现类似av_parser_parse2功能

    本篇文章将深入探讨如何实现一个类似`av_parser_parse2`的功能,这是FFmpeg中用于解析媒体数据的关键函数。我们将讨论NAL单元(Network Abstraction Layer Unit)在H264视频解码中的作用,以及`av_parser_parse2`在...

    JSON2.JS JSON.JS JSON_PARSE.JS

    method and a parse method. The parse method uses the eval method to do the parsing, guarding it with several regular expressions to defend against accidental code execution hazards. On current ...

    push-notification-parse-android:使用 Parse 推送通知示例

    2. **初始化Parse** 在应用的主Activity或Application类中,使用`Parse.initialize()`方法初始化Parse SDK,传入`Application ID`和`Client Key`: ```java Parse.initialize(new Parse.Configuration.Builder...

    Laravel开发-laravel-parse

    在本文中,我们将深入探讨Laravel开发中的一个重要组件——laravel-parse。这是一个专门为Laravel框架设计的Parse SDK桥接器,允许开发者轻松地在Laravel应用程序中集成Parse服务。Parse是一个强大的后端即服务平台...

    CommandScript And XmlParse

    标题“CommandScript And XmlParse”涉及的是一个关于命令脚本处理和XML解析的议题。在这个主题中,我们主要探讨两个核心概念:CommandScript和XmlParse。CommandScript通常指的是使用编程语言编写的一系列命令,...

    Android开发中的Notification应用

    .setSound(Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.notification_sound)) // 设置提示音 .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 100}) // 设置震动...

    excel_parse

    python parse and write excel

    [iOS] Parse 应用开发 (iOS SDK 实现) (英文版)

    Build your applications using Parse iOS which serves as a complete cloud-based backend service Understand and write your code on cloud to minimize the load on the client side Learn how to create your ...

    iOS eCommerce App Development with Parse(Apress,2015).pdf

    iOS eCommerce App Development with Parse uses a real-world app example to teach you how to build a complete eCommerce iPhone app powered by Parse—the most popular and powerful Platform as a Service ...

    json2.js 支持JSON.parse方法

    使不支持JSON.parse的浏览器,可以使用JSON.parse方法。 提供兼容性。

    parse-server-push-adapter:解析服务器的官方推送适配器

    VERBOSE=1orVERBOSE_PARSE_SERVER_PUSH_ADAPTER=1这将为所有推送发送尝试产生更详细的输出在解析服务器上使用自定义版本安装推送适配器 npm install --save @parse/push-adapter@VERSION将 VERSION 替换为您要安装...

    java.text.ParseException: Unparseable date: 2/10/2010 15:20:05

    在给定的标题 "java.text.ParseException: Unparseable date: 2/10/2010 15:20:05" 中,问题的核心在于日期格式“2/10/2010 15:20:05”没有被正确地识别和解析。 这个异常表明,程序正在尝试将这个日期字符串转换成...

    h264_parse解析工具

    《深入理解H264解析工具——h264_parse》 在数字视频编码领域,H.264(也称为AVC,Advanced Video Coding)是广泛应用的一种高效视频压缩标准。它以其高压缩率和良好的图像质量,在互联网、电视广播、移动通信等...

    Laravel开发-laravel-parse-sdk

    在本文中,我们将深入探讨Laravel开发中的一个重要组件——laravel-parse-sdk。这个SDK是专门为Laravel 5设计的,用于连接和操作Parse服务,它允许开发者在自托管的Parse服务器上存储和管理数据,从而扩展了Laravel...

Global site tag (gtag.js) - Google Analytics