Code Monkey home page Code Monkey logo

parse-cloud-debugger's Introduction

This utility is used for debuging Parse.com cloud code.

Problem:

The code deployed on Parse.com cloud is not available for DEBUG. The only way to "debug" the code is using the "console.log" !! Debuging your code allows you to identify the bugs and code faster !!

Solution:

A local NodeJs server wich is simulating the Parse cloud enviroment and where YOU CAN DEBUG your code.

Currently this utility is available for the following Parse APIs:
  • REST API
  • JavaScript API

=====================================================

Demo: http://parse-debugger.parseapp.com

=====================================================

Demo Project Structure

    1. parse-cloud-demo - contains all parse js files and the files of the presention site
    1. parse-cloud-debbuger - local module of the lib used to enable local debugging of parse cloud code

Demo Setup

    1. Get the files from git and open the folder!
  • 2.1. [WINDOWS] Execute "npm install" in that folder as Administrator
  • 2.2. [LINUX] Execute "sudo npm install --unsafe-perm" in that folder (thanks @pcecchetti)
  • 2.3. Set NODE_PATH env param to your 'parse-cloud-code-demo' folder && DEV env param to 'true'
  • 3.1. In 'parse-cloud-code-demo\startLocalDebugging.js' is the code to start the app in debug mode
global.Parse = require("parse-cloud-debugger").Parse;
Parse.initialize( "your app id", "your js key", "your master key");
require('./cloud/main.js');
  • 3.2. Copy the following code in the entrypoint js file in order to enable local debuging on client
///////////////////////////////////////////////////////////////////////////
//REMOVE THIS CODE WHEN YOU DEPLOY 
var runOnParse = false;
var originalParseFunction = Parse._request;

Parse._request = function (options) {
    Parse.serverURL = "https://api.parse.com";

    if (runOnParse === false && options.route == "functions") {
        Parse.serverURL = "http://localhost:5555";
    }

    return originalParseFunction(options);
};
//END CODE
///////////////////////////////////////////////////////////////////////////
  • 4.DEBUG into your IDE or cmd the "startLocalDebugging.js" file from "parse-cloud-code-demo"
  • 5.Now your demo server should be up and running at "http://localhost:3000"
  • 6.See the DEMO section for more details !

Demo

  • 1.This is the HTML page of the "web-js-demo" project !

Overview

  • 2.We're calling the code from Parse.com cloud to test it!

Overview

  • 3.We're calling the same function on our local Parse cloud ("parse-cloud-code-demo")

    • We have 2 breakpoint added for "helloWorld2" function at line 29 and 32
    • The first one(line 29) is on the function entrypoint
    • The second one(line 32) is on the function exits when return the answer

Overview

Overview

    1. We're receiving the answer in browser !

Overview

Not supported for local debugging :

  • Parse.Cloud.beforeSave
  • Parse.Cloud.afterSave
  • Parse.Cloud.beforeDelete
  • Parse.Cloud.afterDelete

parse-cloud-debugger's People

Contributors

mciocan avatar

Watchers

 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.