ISONecroMAn
ISONecroMAn

Reputation: 1526

"MAN stack" how to access a local mongoDB database in angular app.,(no server,complete client side app.)

I have set up a mongoDB databse with lot of data stored among a lot of collections, reside, in a 'data' folder inside my node app folder it self. I needed to create a front end to the database,with CRUD features using angular.I used node,and mongoose to set up database on my disk.I have no intention to upload the DB to a cloud at this point, so i guess, i don't need express,and $http service of angular. My question is this How can i able to get access the mongoose query's from within different angular controllers. ? Is there any services that i can use out of the box, as a dependency ,for the task.

alonge: In my mongoose model folder(in my case angular model itself), i've got a db.js file.This file contain all the mongoose queries that i need to do with my front end(angular view:html file,with ton of partials). You can see, i need to somehow require and use this db.js file inside my angular controller.i don't know how to write the service that would do it though.I wonder "angoose" https://www.npmjs.com/package/angoose Does it do the same thing..

ps 1: I have a plan to make this app a complete desktop app,using nw.js.

ps 2: i am relatively new to angular.js,.

Upvotes: 0

Views: 535

Answers (1)

Boris
Boris

Reputation: 532

From the NW.js docs Example 3 notes that you can use node function require for loading modules like so: var mongoose = require('mongoose');.

The caveat being that you may need to recompile the mongoose module with nw-gyp to make it work with NW.js.

Upvotes: 1

Related Questions