0

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,.

4
  • 1
    I'm unsure thats possible with just angular, but if you use nw.js then you will have node and it's modules for the business layer Commented Dec 31, 2015 at 13:54
  • is angoose npmjs.com/package/angoose would do it..? Commented Dec 31, 2015 at 14:38
  • Okay..,how can i import db.js file into angular (which has got all my necessary mongoose query operations). Making a service, which uses this db.js file, is what i'm thinking. So actually how to do this..? Commented Dec 31, 2015 at 14:44
  • 1
    @SijoPGeorge please edit the question and update the information rather than leaving it in comments Commented Dec 31, 2015 at 15:06

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

How is angular going to communicate with node without making http requests or similar..?
Check out NW.js it's a platform which enables calls directly to Node apis from html.
Well looks like it's using web socket connection... it's no magic ;)
@SijoPGeorge If this helped you, mark it as the correct answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.