Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including baucis-vivify with all npm packages installed. Try it out:

require("mongoose/package.json"); // mongoose is a peer dependency. require("baucis/package.json"); // baucis is a peer dependency. var baucisVivify = require("baucis-vivify")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

baucis-vivify v1.0.1

A module for adding child controller paths

baucis-vivify

A module for adding child controller paths

controller.vivify

This can be used to add paths under a controller. For example, a teacher schema might define an array of classrooms. controller.vivify lets embed the classrooms associated with a teacher at a URL like /teacher/123/classrooms.

var teachers = baucis.rest('teacher');
var classrooms = teachers.vivify('classrooms');

controller.parentPath

This can be used to note the path the schema defines that is associated with a vivified URL. For example, in the above example, if the classroom schema didn't use the field teacher to link to the teachers collection, but instead used a name of classTeachers:

var teachers = baucis.rest('teacher');
var classrooms = teachers.vivify('classrooms').parentPath('classTeachers');
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free