Something to quickly check, if you are not getting any reaction from mongoose in the admin site using the same models, have you ensured that you are initializing the mongo connection in the admin. Mongoose will queue commands until a connection is established.
One approach that I've used it to create a private module with just the models that both the web site and admin site can use. With "npm link" you can set it up locally and then only "copy" on deploy. -- Daniel R. <[email protected]> [http://danielr.neophi.com/] On Wed, Oct 17, 2012 at 4:13 PM, Manuel Schoebel <[email protected]> wrote: > Hi, i am playing with node.js for a little while now and ran in an issue i > want to adress. For this i would like to get some advice. > > First: I'm building a website (it is more a test-project where i'd like to > test and learn some things, so it is okay for me if i "overcomplicate" > things). On the website there is also a blog. I also build a little admin > interface. The admin interface will be its own node.js app. So i have the > website and website-admin as two independent projects. > > I use express.js and mongoose. > > The "Problem": > I tried to share the models of the website with the admin but this does not > work. If i try to get some data in the admin via the websites models, i do > not get any reaction from mongoose, not even an error. As i read somewhere > the models cannot be shared between apps. One option would be to copy the > models into the admin-app. But i do not really like this approach. > > What i want to do: > So i am thinking to separate the models and whole db into a third app. An > api with restify.js. So the website and the admin can use the api and i > would only have the models in one place. The glue between all would be > node-proxy (somehow, i am not exactly sure how to do this right now ;). > > Is there a better way to share the models if i want to separate the admin > and the website as its own node-apps? Does this sound stupid to you? Why? > > Best regards > Manuel > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
