Unitech/angular-bridge is a JavaScript project with 206 stars. Link models easily via a REST interface between Mongoose/Node-Express/Angular.js
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Create, read, update, delete MongoDB collections via AngularJS.
It uses :
Mongoose for accessing to Mongodb
Express for the routing
AngularJS (with the $resource method)
Btw don't forget to include angular-resource.js
Sample code
Backend code
In you db.js backend :
var mongoose = require('mongoose');
var db = mongoose.connect('mongodb://localhost/pizza');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;
var PizzaSchema = new Schema({
author : {
type : String,
},
color : {
type : String
},
size : {
type : Number
},
password : { // You can hide it from read and write ! (cf after)
type : String
}
});
// You can optionally add a method to schema.methods that is executed based
// on the type of HTTP request with the names "query", "get", "put", "post", and "delete"
// The callback receives the affected entities as it's parameter.
PizzaSchema.methods.query = function(entities) {
console.log("Queried:");
console.log(entities);
};
PizzaSchema.methods.get = function(entity) {
console.log("Got:")
console.log(entity);
};
PizzaSchema.methods.put = function(entity) {
console.log("Put:")
console.log(entity);
};
PizzaSchema.methods.post = function(entity) {
console.log("Posted:")
console.log(entity);
};
PizzaSchema.methods.delete = function(entity) {
console.log("Deleted:")
console.log(entity);
};
exports.Pizza = mongoose.model('pizzas', PizzaSchema);
In your backend app.js :
var db = require('./db.js');
// Mount all the resource on /api prefix
var angularBridge = new (require('angular-bridge'))(app, {
urlPrefix : '/api/'
});
// With express you can password protect a url prefix :
app.use('/api', express.basicAuth('admin', 'my_password'));
// Expose the pizzas collection via REST
angularBridge.addResource('pizzas', db.Pizza);
// Hiding fields
angularBridge.addResource('toppings', db.Toppings, { hide : ['_id', 'password']});
// Read-only fields (sent to client, but will not write to database)
angularBridge.addResource('jaboodies', db.Jaboody, { readOnly: ['_id', 'cantChangeMe']});
// Force a mongoose query (to restrict access to certain items only)
angularBridge.addResource('projects', db.Project, { query: '{_user: String(req.user._id)}'});
// Note: This can be passed as an object, but you can also pass it as a string
// in cases where the object you're looking for is only accessible within
// the HTTP-verb callback (in this example, 'req' will give an error if it
// is not passed as a string)
// Force a particular value regardless of what the client sends
angularBridge.addResource('clients', db.Client, { force: {_user: 'req.user._id' }});
// Enable population for the given fields
angularBridge.addResource('projects', db.Project, { populate: "_ref1" });
BE CAREFUL! force AND query BOTH USE eval()
Front end code
That's all for the backend, now in Angular :
var HomeCtrl = function($scope, $routeParams, $location, $resource) {
var PizzaDb = $resource('/api/pizzas/:id', { id: '@_id' });
// Magic, you are ready now !
var new_pizza = new PizzaDb({
author : 'agoodpizayolo',
color : 'blue',
size : 999
});
new_pizza.$save(function(save_the_pizza) {
console.log('Success pizza - ', save_the_pizza);
});
PizzaDb.get({id : '50b40dd6ed3f055a27000001'}, function(pizza) {
pizza.color = 'UV';
pizza.$save();
});
};
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
How active is development on Unitech/angular-bridge?
The most recent commit recorded on Unitech/angular-bridge was 8.6 years ago, based on the GitHub push timestamp. The repository has 22 forks — one of the better signals of community interest.
How many stars does Unitech/angular-bridge have?
Unitech/angular-bridge has 206 GitHub stars — refresh the page for the live number, or check github.com/Unitech/angular-bridge. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is Unitech/angular-bridge open source?
TopGit's metadata for Unitech/angular-bridge does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What is Unitech/angular-bridge?
Unitech/angular-bridge (Unitech/angular-bridge) is a JavaScript project on GitHub. From the project's own README: Link models easily via a REST interface between Mongoose/Node-Express/Angular.js
What language is Unitech/angular-bridge written in?
Unitech/angular-bridge is written primarily in JavaScript. GitHub's language field is based on the largest share of bytes in the default branch.
Where do I read more about Unitech/angular-bridge?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/Unitech/angular-bridge is the definitive source.
Read full README in the tab above.
Is angular-bridge worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of angular-bridge.