-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling a Function in Index.js from Cloud Function #4531
Comments
in index.js , export your function and in your cloud code javascript file, you can import the function derived from the index page. There are several syntaxes for exporting and importing, use the es6 way id you are using nodejs 6xx + : index.js: export function call_this_function_from_cloud_code(req, res){} cloud/main.js import { call_this_function_from_cloud_code } from “../index”; ... |
@tolgaatam I am not clear, any simple code snippets? |
index.js //Parse Server Initialization
var api = new ParseServer({
databaseURI: databaseUri,
......
});
Parse.Cloud.define("sendToChat", function (req, res) {
console.log("It is called in the index.js");
}); cloud/main.js Parse.Cloud.run('sendToChat', {}).then(function (ratings) {
// ratings should be 4.5
}); Parse is globally defined you should be able to use Parse Queries and Parse.Cloud in your index.js. Thanks @dplewis |
I know how to call a function and pass values from index.js to Cloud Code
How to do this in reverse side? Calling a function in Index.js from a Cloud function.
index.js
cloud/main.js
The text was updated successfully, but these errors were encountered: