Skip to content

Check out this module for Parse.Cloud #4317

Closed
@jcguarinpenaranda

Description

@jcguarinpenaranda

Hello,

First I want to thank all the community for being so active, and the people who are working so we can have new versions of parse-server.

I have been working with parse-server some time after Parse announced they were not going to continue, and I want to share with you a module I created for being able to manage more easily the Cloud Code. It is called ParseCloudClass and you can see it here

The module

With parse-cloud-class module you can easily:

  • Define minimum values for keys on your classes
  • Define default values
  • Define required keys
  • Use addons to easily extend the funcionality of your app
  • Create new addons and share them with the community
  • Customize the default behaviour to your own needs

The usage is very simple, like this:

// cloud/main.js
// with typescript or ES6
import { ParseCloudClass } from 'parse-cloud-class';

const myConfig = new ParseCloudClass({
  // new items will not be created if they have no 'name' set
  requiredKeys: ['name']
  defaultValues: {
    // all new items will have by default active: true
    active: true,
    // by default, timesShared will be 0
    timesShared: 0,
  },
  minimumValues: {
    // timesShared cannot go below 0
    timesShared: 0,
  }
});

// Configure your class to use the configuration
ParseCloudClass.configureClass(Parse, 'MyClass', myConfig);

A word on the addons

I think being able to use other community-made scripts for parse-server would be something very nice to have, and would continue to make our life easier as developers.

In this way, using ParseCloudClass I think we could have in the future some modules to connect the data with some Analytics service like Mixpanel, or with other services such as Algolia; or even having a replication plugin that syncs the data with DynamoDB or any other database.

The only thing needed, would be that the new module implements afterSave or afterDelete (there are more functions)

Note

I am posting this here because I think somebody else would like to easily configure the Parse Cloud classes with this basic functionality, or extend it in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions