A mean ninja

The mean.io integration module...
http://mean.io is a fullstack js project by linnovate which provides an approach to build web applications with the mean stack - Mongo, Express, Angular.js and Node.js

The concept behind the module is not to create another rest compliant service end point but instead let you bundle the json representations of the views, block and menus that you might need if you want to include dynamic data built on Drupal into your mean based application.

The module presents a menu item that follows the next rules and provides a hook that gives other modules the ability to create packets that can be bundles as well...

URL stucture: /mean/json/[TYPE]/[NAME]/[ARG1]/[ARG2]/[ARG3]
currently supported TYPE values and their arguments:

- view - returns results for requested Drupal view object, arguments:
  - NAME - view's name
  - ARG1 - (optional) display_name
  - ARG2 - (optional) items per page value (-1 for unlimited, 0 - skip arg)
  - ARG3 - (optional) arguments divided by '+' sign without whitespaces
  
- menu - output from menu_tree_all_data() function

- load - looks for load_[NAME_mandatory] function and returns its output 
(node_load([ARG1]), user_load([ARG1]), menu_load([ARG1]) ...), arguments:
  - ARG1 - ID or name to pass to load function

- help - /mean/json/help/me will output current instruction

- taxonomy
  - returns output of taxonomy_get_tree($name), $name is vocabulary ID
  if term_fields module is enabled and there are fields, they will be
  attached to $term->fields, if the field is file, its absolute URL
  will be returned instead of FID

- role
  - return output of user_roles()

- user - /mean/json/user/logout - Logging current user out
  - /mean/json/user/login (along with name and pass values passed as post
  will log user in and return its object)
  - /mean/json/user/session - returns $_SESSION
  - /mean/json/user/me - returns global user object
  
- get-mean-packet 
  - returns set of JSON objects, set at admin/build/mean-packets
  - NAME - packet's name

-------------------------------------------------------------------------
To skip any optional ARG, use 0, (example: /mean/json/forum_search/0/5)

Sub-Modules

MEAN Shadow

The MEAN Shadow module provides the ability to shadow entities from drupal to the MEAN stack.
You can choose through the settings pages which entities will be automatically shadowed on insert/update'
'delete' is not yet supported.

Shadowing entities allows you to have more freedom when you want to use the drupal entities directly from the MEAN stack.
A good use case for that is a graph or statistics page where you don't want to constantly use ajax requests to get data from the drupal server side.

In addition you can manually use drush to batch shadow the existing entities to the MEAN stack.
* Feel free to use "drush shanties" instead of the long "drush shadow-entities", it's MEANer :)

Examples:
 Standard example (all the user entities)  drush shadow-entities
 Type example (all the node entities)      drush shadow-entities node
 Id example (specific user)                drush shadow-entities user 42
 Id example 2 (specific node)              drush shadow-entities node 42
 Bundle example (all the entites of        drush shadow-entities node article
 bundle article)

Arguments:
 entity type                               An optional type to shadow, user (default) or node
 bundle type                               An optional bundle (node type)
 id                                        An optional id to shadow

Project information

Releases