Skip to content
/ core Public

Base object that provides common functionality and gets extended by the other facet modules

License

Notifications You must be signed in to change notification settings

facetta/core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facet Core

Base object that provides common functionality and gets extended by the other facet modules. Core offers access to the following functionality:

  • Abstration of middleware specific code for framework agnostic use
  • Handling of request/response lifecycle
  • Built in CRUD functionality via find, findOne, create, update, delete functions for any resource you create
  • Management of event bus (aka Intercom) used for decoupled module communication

Example

"use strict";
var util = require('util'),
  ApiCore = require('facet-core').ApiCore;

var ProductAPI = function ( options ){};

/**
 * Product API inherits from Core API
 */
util.inherits(ProductAPI, ApiCore);

// query.conditions, query.fields, and query.options 
// are regular mongoose queries
var query = {
  conditions: {name: 'Cool Item'},
  fields: '',
  options: {
    lean: true
  }
}

// FacetApiCore.find() is a wrapper for mongoose's find(), same 
// with findOne(), create(), remove() and update()
ProductAPI.find(query, successCb, errorCb);

About

Base object that provides common functionality and gets extended by the other facet modules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published