GithubHelp home page GithubHelp logo

tianguanghui / cloudcode-express Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liviuignat/cloudcode-express

0.0 1.0 0.0 10 KB

Example of the parse-cloud-express module and automatic webhooks registration

JavaScript 99.85% HTML 0.15%

cloudcode-express's Introduction

Cloud Code in Express/Node.JS

Take your existing cloud code files and place them in the cloud/ folder. Add the following line at the very top of each file:

var Parse = require('parse-cloud-express').Parse;

Set up some environment variables:

export PARSE_APP_ID=yourappid
export PARSE_MASTER_KEY=yourmasterkey
export PARSE_WEBHOOK_KEY=yourkeyhere

Download all required dependencies with:

npm install

Run your new server:

node server.js

Local testing

Set up ngrok and once your server is launched, run ngrok in a different terminal window:

// Port 5000 is provided as a default in server.js, can be changed by PORT environment variable
ngrok http 5000

Take the URL provided by ngrok, set it as an environment variable, and run the script to register your webhooks with Parse:

export HOOKS_URL=https://something.ngrok.io/
npm run register

Caveats

Cloud Code required you to use cloud/ as a prefix for all other .js files, even though they were in the same folder. That doesn't apply here, so you'll need to update any require statements in files under cloud/ to reference just ./ instead.

The first-party modules hosted by Parse will not be available (sendgrid, mailgun, stripe, image, etc.) and you'll need to update your code to use the official modules available via npm.

The base mount path is set in both server.js and scripts/register-webhooks.js and must be equal.

cloudcode-express's People

Contributors

gfosco avatar braker1nine avatar grantland avatar huguesbr avatar pavanka avatar

Watchers

GreyWolf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.