Skip to content
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

Check out this module for Parse.Cloud #4317

Closed
jcguarinpenaranda opened this issue Nov 3, 2017 · 12 comments
Closed

Check out this module for Parse.Cloud #4317

jcguarinpenaranda opened this issue Nov 3, 2017 · 12 comments

Comments

@jcguarinpenaranda
Copy link
Contributor

jcguarinpenaranda commented Nov 3, 2017

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.

@flovilmart
Copy link
Contributor

That’s a Neat little project you got here! I was thinking about discovery of such ‘addons’ / community packages, and that would be nice if published as: parse-server-addon-YOUR_PACKAGE_NAME

what do you think?

@jcguarinpenaranda
Copy link
Contributor Author

Very nice!

Right now it is published as parse-cloud-class, but I can move it to parse-server-addon-cloud-class

@jcguarinpenaranda
Copy link
Contributor Author

Now it is changed, and available in npm as parse-server-addon-cloud-class. I will be working on other addon for Algolia

@flovilmart
Copy link
Contributor

Awesome! That will probably help discovery! I’ll check with others if we wanna move adapters to the same pattern parse-server-adapter-*.

@jcguarinpenaranda
Copy link
Contributor Author

jcguarinpenaranda commented Nov 4, 2017

As promised, I did the Algolia addon I was talking about:
https://github.com/owsas/parse-server-addon-cloud-algolia

It is available in npm as parse-server-addon-cloud-class-algolia :) and keeps in sync the data between Algolia and the database you use in parse-server

@flovilmart
Copy link
Contributor

Pretty cool! I’ll make a PR on the README, so other users know about this new convention for community packages discovery.

@jcguarinpenaranda
Copy link
Contributor Author

Can you please post these repos to parse-server-modules ?

@flovilmart
Copy link
Contributor

What do you mean by that?

@jcguarinpenaranda
Copy link
Contributor Author

I see that in that account or repository you have linked several adapters for parse-server. Community made addons can appear there?

@flovilmart
Copy link
Contributor

Those are not linked. This organization was created when Parse-server was still under facebook’s management and for official adapters/reference implementations. Now, while your addons are quite useful in certain scenarios, I don’t believe they should live under this organization as it would form some kind of endorsement / official support. We have our hands pretty busy already, and i was actually thinking moving most of the official adapters back to parse-Community instead of parse-server-modules.

@jcguarinpenaranda
Copy link
Contributor Author

jcguarinpenaranda commented Nov 6, 2017 via email

@tejpratap46
Copy link

We can do a Awesome Parse Server list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants