metageo-core
v0.0.4
Published
provides the core API and functions for metageo
Downloads
5
Readme
metageo-core
Provides the core api metageo.
Usage
metageo-core is a hapi plugin and exposes the following properties
- eventController - A generic event handler that event schemas can uses initaited from generic handlers. For example see the social schema
- models - the mongoose models
- mongoose - the mongoose instance. You should use this instance to avoid opening multiple connection to the DB.
- utils - a few random utilities. see here
Example Usage for metageo-core inside another hapi plugin
//require an mongoose schema
myNewEventSchema = require('myNewEventSchema')
exports.register = function(plugin, option, next){
var core = plugin.plugins['metageo-core'];
//create a controller for your new schema
controller = new (core.eventController)({model : myNewEventSchema});
//add some routes
plugin.route({
method: "GET",
path: "/api/event/myNewEventType/{_id}",
config:{
handler: controller.findOne
}
});
}
Rest API
See the full documentation here. The following endpoints are made avalible.
- /session - manages sessions
- /user - manages user CRUD
- /event - forwords event CRUD to the proper handler
- /events - aggergates events
- /lists CRUD for lists
Tests
Tests are done with mocha.
To run npm test