Deploying cloud code

hi there … wondering if i have to resart parse server everytime i change my cloud code

Yes, the server needs to be restarted. I’d recommend using nodemon to auto-restart your server everytime you save a file for easier development.

4 Likes

Actually you can do it without restarting the server (we’re doing it). If the server is notified of the change, it can define the function(s) again. Only problem is that Parse logs a warning for the replacement of the previous function if it was already defined. That’s a minor issue, but I think that the Parse code should acknowledge this use case, restarting the server outside maintenance schedules can cause issues.

How? Can you show me?

How? Can you show me?

By calling Parse.Cloud.define with the new code

I know that. I’m asking how to update code without restarting parse server

We send a notification to the server when the code has changed, alternatively the server can process the change in an afterSave trigger because the cloud code is stored in the database. Then the server loads the new code from the database as text, converts it to executable code and calls Parse.Cloud.define with the new code as parameter.

I’m still working on this PR that will hopefully allow for dashboard cloud code editing with auto-restart :blush:

1 Like

Just FYI: this is more of a feature for the example repo rather than the core server.

This PR will add npm run watch to your local Parse Server, and will rebuild the server on Cloud Code change.