Validated Method

screenshot of Validated Method

Meteor methods with better scoping, argument checking, and good defaults.

Overview:

The mdg:validated-method package is a simple wrapper for Meteor.methods that allows for defining Meteor methods in a structured way with mixins. This package aimed to eliminate the best-practices boilerplate around methods. With the capability to use the package in both Meteor 1.2 and 1.3, it brings convenience and efficiency to method definition in Meteor applications.

Features:

  • Object Representation: Represent your method using an object and reference it through JavaScript scope rather than a string name.
  • Built-in Validation: Utilize built-in validation of arguments through aldeed:simple-schema or create custom argument validation.
  • Testing Convenience: Easily call methods from tests or server-side code with the ability to pass in any user ID.
  • Client-Side Error Handling: Prevent execution of server-side methods by throwing errors from client-side method simulation.
  • Consistent ID Generation: Retrieve the stub's return value by default for consistent ID generation.
  • Method Extensions: Extend methods using mixins for enhanced functionality.
  • Code Samples: Access extensive code samples in the Todos example app for reference.