Giter Site home page Giter Site logo

Schema examples please about examples HOT 3 CLOSED

totaljs avatar totaljs commented on August 17, 2024
Schema examples please

from examples.

Comments (3)

molda avatar molda commented on August 17, 2024 3

Hi, the best SCHEMA example is https://github.com/totaljs/cms Have a look at ./controllers/manager.js which uses multiple schemas then check ./models/ folder for how the schemas are defined.
It's clearly much better example then any TODO app could ever be.

@carlos-duran the difference between $save and $workflow
As the name $save suggest it servers the purpose of saving document into DB, whereas $workflow can do anything you want, which means you can create a workflow for saving data too, so in a way you can say $save is alternative for $workflow('save') . To give You an example imagine following situation. A user fills in a register form on Your page and submits it then on the server You need to check if the user's email already exists in DB and if not then save the user data and send him an email confirmation of registration. Now in the code it would look like this:

//controller
F.route('/register', json_register, ['post', '*User']);

function json_register(){
  var self = this;

  self.body.$async(self.callback(), 1).$workflow('check.email').$save().$workflow('send.confirmation');
}

This gives you clear view of what's going on in the code.
Have a look at the cms I mentioned above. It's really great example.

from examples.

gnetsys avatar gnetsys commented on August 17, 2024

+1 👍 There need for this, a simple TODO app would be great..

from examples.

carlos-duran avatar carlos-duran commented on August 17, 2024

Thank you for the answer. I will see the cms source code 👍

Have a good day.

from examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.