angularjs - Node.js + Angular = Uncaught ReferenceError: require is not defined -


i'm creating express.js api on node.js server. api used access data stored on server. keep log of who's accessing api in database.

i'm trying create admin section use angular.js display admin access logs neatly. used angular express bootstrap seed start project:

https://github.com/jimakker/angular-express-bootstrap-seed/

my problem need controllers.js access node modules doesn't seem know node exists. here error:

controller.js  var mongo = require('mongodb'); [uncaught referenceerror: require not defined] 

how can use node modules in angular.js files?

node server side technology, not typically use node modules on browser angular.js. however, if want commonjs require functionality in browser see: https://github.com/substack/node-browserify.

ofcourse, browser can't talk mongodb directly why need api in first place, angular communicate api using http.

angular.js makes $http call node.js requires , talks mongodb.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -