Last active
January 27, 2018 15:28
-
-
Save rodrigobdz/506ca6a41f220c6dcb1b57d0fa788aaa to your computer and use it in GitHub Desktop.
Run a single Parse Server function using node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sublime Text - Build System for Javascript | |
// | |
// Created using the instructions shown in | |
// https://gist.github.com/corbanb/d0d6bdcfbd8eb455ce99 | |
{ | |
"cmd": ["/usr/local/bin/node", "$file"], | |
"selector": "source.js", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "parse_server_run", | |
"version": "0.0.1", | |
"description": "Runs a single parse server function", | |
"preferGlobal": "false", | |
"bin": { | |
"parse_server_run": "parse_server_run.js" | |
}, | |
"author": "Rodrigo Bermudez Schettino", | |
"engines": { | |
"node": "*" | |
}, | |
"dependencies": { | |
"parse": "^1.10.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
var Parse = require('parse/node') | |
// | |
// Variables to set | |
// | |
let parse_function_name = 'YOUR_PARSE_FUNCTION_NAME' | |
let parse_function_params = {} | |
const Config = { | |
parse: { | |
url: 'http://localhost:1337', | |
app_id: 'YOUR_APP_ID', | |
javascript_key: 'YOUR_JAVASCRIPT_KEY', | |
} | |
} | |
// Parse Server initialization | |
Parse.serverURL = Config.parse.url | |
Parse.initialize(Config.parse.app_id, Config.parse.javascript_key) | |
// Run Parse Server function | |
Parse.Cloud.run(parse_function_name, parse_function_params).then(function(result){ | |
console.log('result ', result) | |
}, function(error) { | |
console.error('error ', error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run a single Parse Server function using node
Requirements
parse_function_name
,parse_function_params
andConfig
in parse_server_run.js.Usage
Command line
package.json
andparse_server_run.js
to a common directory.npm link
.parse_server_run
script in the console.Sublime Text