Received: by 10.58.127.226 with SMTP id nj2mr4513565veb.3.1350546834390; Thu, 18 Oct 2012 00:53:54 -0700 (PDT) X-BeenThere: nodejs@googlegroups.com Received: by 10.220.154.5 with SMTP id m5ls236640vcw.2.gmail; Thu, 18 Oct 2012 00:53:42 -0700 (PDT) Received: by 10.52.71.38 with SMTP id r6mr3425581vdu.12.1350546822338; Thu, 18 Oct 2012 00:53:42 -0700 (PDT) Date: Thu, 18 Oct 2012 00:53:41 -0700 (PDT) From: greelgorke To: nodejs@googlegroups.com Message-Id: In-Reply-To: References: <0836adec-6ae6-4e01-baf2-a91c3fa3b74f@googlegroups.com> Subject: Re: [nodejs] Webapplication/-site structure with express.js and restify.js MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_962_19226840.1350546821600" ------=_Part_962_19226840.1350546821600 Content-Type: multipart/alternative; boundary="----=_Part_963_28448450.1350546821603" ------=_Part_963_28448450.1350546821603 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit +1 for packaging out the shared code. this is how node handle code re-usage at all Am Donnerstag, 18. Oktober 2012 03:52:11 UTC+2 schrieb Daniel R.: > > 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. > [http://danielr.neophi.com/] > > > > On Wed, Oct 17, 2012 at 4:13 PM, Manuel Schoebel > > 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 nod...@googlegroups.com > > To unsubscribe from this group, send email to > > nodejs+un...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/nodejs?hl=en?hl=en > ------=_Part_963_28448450.1350546821603 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit +1 for packaging out the shared code. this is how node handle code re-usage at all

Am Donnerstag, 18. Oktober 2012 03:52:11 UTC+2 schrieb Daniel R.:
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. <dan...@neophi.com> [http://danielr.neophi.com/]


On Wed, Oct 17, 2012 at 4:13 PM, Manuel Schoebel <ma...@manuelschoebel.de> 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 nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
------=_Part_963_28448450.1350546821603-- ------=_Part_962_19226840.1350546821600--