Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion "include" functionality?

Received: by 10.227.152.196 with SMTP id h4mr571170wbw.21.1280241159318;
        Tue, 27 Jul 2010 07:32:39 -0700 (PDT)
X-BeenThere: express-js@googlegroups.com
Received: by 10.216.68.149 with SMTP id l21ls1164096wed.3.p; Tue, 27 Jul 2010 
	07:32:38 -0700 (PDT)
Received: by 10.216.162.15 with SMTP id x15mr615436wek.14.1280241158282;
        Tue, 27 Jul 2010 07:32:38 -0700 (PDT)
Received: by 10.216.162.15 with SMTP id x15mr615435wek.14.1280241158195;
        Tue, 27 Jul 2010 07:32:38 -0700 (PDT)
Return-Path: <kadirpe...@gmail.com>
Received: from mail-wy0-f180.google.com (mail-wy0-f180.google.com [74.125.82.180])
        by gmr-mx.google.com with ESMTP id r4si1781038wec.14.2010.07.27.07.32.37;
        Tue, 27 Jul 2010 07:32:37 -0700 (PDT)
Received-SPF: pass (google.com: domain of kadirpe...@gmail.com designates 74.125.82.180 as permitted sender) client-ip=74.125.82.180;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of kadirpe...@gmail.com designates 74.125.82.180 as permitted sender) smtp.mail=kadirpe...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by mail-wy0-f180.google.com with SMTP id 33so4428540wyb.11
        for <express-js@googlegroups.com>; Tue, 27 Jul 2010 07:32:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:received:in-reply-to
         :references:date:message-id:subject:from:to:content-type;
        bh=ex3X4MdWX5twSIqeQ0NThCuoZZ5Hi++Az/ucwdHqBl4=;
        b=vnHgYnaDboRKq70c3fHTtAq7Mey83n0aSBvZ9uD9ayyvC2q8a+k6ZKkJ2tQ+KhoY81
         tAjcam7JStVwdpchgGh4uXSFwxEm9aVG4QDULQtokR3KsmgBBLB3wmmy5tnTerIHekl6
         a/3SCrEZzSA+uKp0UljHpHAKPyeREj7QEnhUk=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        b=PwqJFGTVXiIQjMbX70Lm2+Jk+EcroW0m36+7Nd15ldefwv1/wVRxUjJdiL2LAsiQmD
         X6Z8cibeJQkpJip7Ih+5HT9O/gBQfyCUipNLLYM4sGxfycwbChDz88XataKxtH5rPuwi
         cad5R0z3QoI2aZrj3io8v6O7vQAt5iTNQBI7U=
MIME-Version: 1.0
Received: by 10.227.128.4 with SMTP id i4mr8921056wbs.106.1280241156750; Tue, 
	27 Jul 2010 07:32:36 -0700 (PDT)
Received: by 10.227.145.13 with HTTP; Tue, 27 Jul 2010 07:32:36 -0700 (PDT)
In-Reply-To: <AANLkTinx3Fv4djcXm35LOgeEdPfS6Nq_-FHuuo7Yc...@mail.gmail.com>
References: <AANLkTi=6ZsnWoG0kwekKGvNx37EOqvntd2H2Cx6P+...@mail.gmail.com>
	<AANLkTikyPTFUQDR=9PCTRYE8yvsEJbW9hCjbYODys...@mail.gmail.com>
	<AANLkTimc=U3enX0w9u5wz_Pd11uUMTei=xsnh4UHG...@mail.gmail.com>
	<AANLkTimArWEjNnTZQw1Ug=LBkrtOOK0EPGkWp0-_a...@mail.gmail.com>
	<AANLkTi=xP4VM_6vxPasj9dR5=y=TN28gZkhLnitxn...@mail.gmail.com>
	<AANLkTinreyd1cdHuHp39cNPqKzA0g7bs4FTAd+Bdp...@mail.gmail.com>
	<AANLkTikJKGmXVLWLWTmcUKPcBXA-3s2dXLcYGEfDn...@mail.gmail.com>
	<E4ECF798-2667-4090-AA6E-39029556B...@gmail.com>
	<AANLkTikSYm-DSbYFT_As3_UFS+b4CsLDZHzpdUgS6...@mail.gmail.com>
	<AANLkTikH8g9oaB1Atr44Hj97Xpseb1G3a0B6jRc7n...@mail.gmail.com>
	<AANLkTinx3Fv4djcXm35LOgeEdPfS6Nq_-FHuuo7Yc...@mail.gmail.com>
Date: Tue, 27 Jul 2010 17:32:36 +0300
Message-ID: <AANLkTi=RYJ_UJ03ZfzuQzjj=TUi0y=sxAHR4cSp=2...@mail.gmail.com>
Subject: Re: "include" functionality?
From: Kadir Pekel <kadirpe...@gmail.com>
To: express-js@googlegroups.com
Content-Type: multipart/alternative; boundary=001636832ef4602dd1048c5f5fa7

--001636832ef4602dd1048c5f5fa7
Content-Type: text/plain; charset=ISO-8859-1

As a module, knowing about its parent is less 'modular' i think. The two of
your approachs seems fine, but as a convention i'd rather prefer module to
know nothing about any parent candidate and better waiting for milk from any
of them :)

However, it rocks anyway, it's some sort of tastes within the freedom of
javascript world.


On Tue, Jul 27, 2010 at 5:07 PM, vision media [ Tj Holowaychuk ] <
t...@vision-media.ca> wrote:

> hell you might even want to module.exports = function(app){ app.get(...) }
>
> and then require('./foobar')(app)
>
> explicitly passing your app instance
>
> On Tue, Jul 27, 2010 at 7:06 AM, vision media [ Tj Holowaychuk ] <
> t...@vision-media.ca> wrote:
>
>> The example is not magic at all if your used to node modules, I would not
>> call
>> it elegant but the point is nothing is imposed, any way you choose to get
>> your
>> app from one module to another is fine :)
>>
>>
>> On Tue, Jul 27, 2010 at 5:47 AM, Kadir Pekel <kadirpe...@gmail.com>wrote:
>>
>>> +1 for Hecmann's
>>>
>>> My humble opinion is doing it with less magic for more understandable and
>>> acceptable structure.
>>>
>>> thnks.
>>>
>>>
>>> On Tue, Jul 27, 2010 at 3:25 PM, Aaron Heckmann <
>>> aaron.heckm...@gmail.com> wrote:
>>>
>>>> The only other option I see is to export a method from your child module
>>>> that accepts an app instance which you then use to wire up routes - and that
>>>> is far less elegant.
>>>>
>>>> On Jul 26, 2010, at 11:14 PM, "Jeffrey 'jf' Lim" <jfs.wo...@gmail.com>
>>>> wrote:
>>>>
>>>> > yeah thanks, guys! this is precisely what I'm looking for (although
>>>> > yes :), a more elegant way would be great... But hey, it works!!!) - a
>>>> > way to be able to refer to 'app' in require-d files... And Kadir, I am
>>>> > subscribed. I just missed out on that thread. Thanks for pointing it
>>>> > out!!!
>>>> >
>>>> > -jf
>>>> >
>>>> >
>>>> >
>>>> > On Tue, Jul 27, 2010 at 12:04 AM, vision media [ Tj Holowaychuk ]
>>>> > <t...@vision-media.ca> wrote:
>>>> >> The parent module reference is a bit weird I know, but it works just
>>>> fine. I
>>>> >> would love
>>>> >> suggestions for a clear way to do this, but you cant just simply
>>>> >> require('./app') or similar
>>>> >> because you will cause a cyclic require and segfault :) this is the
>>>> best
>>>> >> approach I have come
>>>> >> up with
>>>> >>
>>>> >> On Mon, Jul 26, 2010 at 6:18 AM, Kadir Pekel <kadirpe...@gmail.com>
>>>> wrote:
>>>> >>>
>>>> >>> Hi Jeffrey,
>>>> >>>
>>>> >>> It was also discussed yesterday.
>>>> >>>
>>>> >>>
>>>> >>>
>>>> http://groups.google.com/group/express-js/browse_thread/thread/80f21aba4cb54e58#
>>>> >>>
>>>> >>> You'd better subscribe to group if you are really interested in :)
>>>> >>>
>>>> >>> Good luck with Express.
>>>> >>>
>>>> >>> On Mon, Jul 26, 2010 at 3:19 PM, Aaron Heckmann <
>>>> aaron.heckm...@gmail.com>
>>>> >>> wrote:
>>>> >>>>
>>>> >>>> I believe what you're looking for is in the blog example:
>>>> >>>>
>>>> http://github.com/visionmedia/express/blob/master/examples/blog/app.js
>>>> >>>> In app.js, the server instance is assigned to module.exports so
>>>> that
>>>> >>>> child modules have access to "app" (the server) as well.
>>>> >>>> Now take a peek at contact.js
>>>> >>>>
>>>> >>>>
>>>> http://github.com/visionmedia/express/blob/master/examples/blog/contact.js
>>>> >>>> Here you see how to set up routes in child modules by accessing
>>>> >>>> "module.parent.exports" which is the "app" in app.js.
>>>> >>>>
>>>> >>>> On Mon, Jul 26, 2010 at 6:33 AM, Sam Millman <smill...@nhbs.co.uk>
>>>> wrote:
>>>> >>>>>
>>>> >>>>> require should work both ways since it just includes the page code
>>>> into
>>>> >>>>> the current document then it is upto you to instantiate the object
>>>> yourself.
>>>> >>>>>
>>>> >>>>> On 26 July 2010 11:29, Sam Millman <smill...@nhbs.co.uk> wrote:
>>>> >>>>>>
>>>> >>>>>> you mean:
>>>> >>>>>> require("sys");
>>>> >>>>>> or:
>>>> >>>>>> require("./mongod/somecheeseyclassthatIwantincluded")
>>>> >>>>>> In turn this allows you to propogate a class. Is this what you
>>>> mean or
>>>> >>>>>> do you meant the php include where it acts as a part of the file?
>>>> >>>>>> so:
>>>> >>>>>> require("sys") would mean the code of that file is placed into
>>>> the
>>>> >>>>>> current document allowing the code to be manipulated as if it
>>>> wasnt in a
>>>> >>>>>> different file?
>>>> >>>>>> On 26 July 2010 09:54, Jeffrey 'jf' Lim <jfs.wo...@gmail.com>
>>>> wrote:
>>>> >>>>>>>
>>>> >>>>>>> Anybody wondered about this? I come from a sinatra background
>>>> :), and
>>>> >>>>>>> I very much like the ability to be able to arbitrarily split off
>>>> >>>>>>> related functionality/code into different files (eg. I want to
>>>> split
>>>> >>>>>>> off the "app.get('/user/xxx', ...)" stuff into another file, say
>>>> >>>>>>> users.js). In sinatra, you could do this with a 'require'.
>>>> >>>>>>> Unfortunately, this doesnt seem possible with node/expressjs. Or
>>>> is
>>>> >>>>>>> there something i'm missing? Does anybody miss/want this
>>>> >>>>>>> functionality?
>>>> >>>>>>>
>>>> >>>>>>> -jf
>>>> >>>>>>>
>>>> >>>>>>> --
>>>> >>>>>>> "Every nonfree program has a lord, a master --
>>>> >>>>>>> and if you use the program, he is your master."
>>>> >>>>>>>     --Richard Stallman
>>>> >>>>>>>
>>>> >>>>>>> "It's so hard to write a graphics driver that open-sourcing it
>>>> would
>>>> >>>>>>> not help."
>>>> >>>>>>>     -- Andrew Fear, Software Product Manager, NVIDIA Corporation
>>>> >>>>>>> http://kerneltrap.org/node/7228
>>>> >>>>>>>
>>>> >>>>>>> --
>>>> >>>>>>> You received this message because you are subscribed to the
>>>> Google
>>>> >>>>>>> Groups "Express" group.
>>>> >>>>>>> To post to this group, send email to
>>>> express-js@googlegroups.com.
>>>> >>>>>>> To unsubscribe from this group, send email to
>>>> >>>>>>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> >>>>>>> For more options, visit this group at
>>>> >>>>>>> http://groups.google.com/group/express-js?hl=en.
>>>> >>>>>>>
>>>> >>>>>>
>>>> >>>>>>
>>>> >>>>>>
>>>> >>>>>> --
>>>> >>>>>> Bow Chicka Bow Wow
>>>> >>>>>
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> --
>>>> >>>>> Bow Chicka Bow Wow
>>>> >>>>>
>>>> >>>>> --
>>>> >>>>> You received this message because you are subscribed to the Google
>>>> >>>>> Groups "Express" group.
>>>> >>>>> To post to this group, send email to express-js@googlegroups.com.
>>>> >>>>> To unsubscribe from this group, send email to
>>>> >>>>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> >>>>> For more options, visit this group at
>>>> >>>>> http://groups.google.com/group/express-js?hl=en.
>>>> >>>>
>>>> >>>>
>>>> >>>>
>>>> >>>> --
>>>> >>>> Aaron
>>>> >>>> http://clickdummy.net
>>>> >>>>
>>>> >>>> --
>>>> >>>> You received this message because you are subscribed to the Google
>>>> Groups
>>>> >>>> "Express" group.
>>>> >>>> To post to this group, send email to express-js@googlegroups.com.
>>>> >>>> To unsubscribe from this group, send email to
>>>> >>>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> >>>> For more options, visit this group at
>>>> >>>> http://groups.google.com/group/express-js?hl=en.
>>>> >>>
>>>> >>>
>>>> >>>
>>>> >>> --
>>>> >>> Kadir Pekel
>>>> >>>
>>>> >>> --
>>>> >>> You received this message because you are subscribed to the Google
>>>> Groups
>>>> >>> "Express" group.
>>>> >>> To post to this group, send email to express-js@googlegroups.com.
>>>> >>> To unsubscribe from this group, send email to
>>>> >>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> >>> For more options, visit this group at
>>>> >>> http://groups.google.com/group/express-js?hl=en.
>>>> >>
>>>> >>
>>>> >>
>>>> >> --
>>>> >> Tj Holowaychuk
>>>> >> Vision Media
>>>> >> President & Creative Lead
>>>> >>
>>>> >> --
>>>> >> You received this message because you are subscribed to the Google
>>>> Groups
>>>> >> "Express" group.
>>>> >> To post to this group, send email to express-js@googlegroups.com.
>>>> >> To unsubscribe from this group, send email to
>>>> >> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> >> For more options, visit this group at
>>>> >> http://groups.google.com/group/express-js?hl=en.
>>>> >>
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed to the Google
>>>> Groups "Express" group.
>>>> > To post to this group, send email to express-js@googlegroups.com.
>>>> > To unsubscribe from this group, send email to
>>>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> > For more options, visit this group at
>>>> http://groups.google.com/group/express-js?hl=en.
>>>> >
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Express" group.
>>>> To post to this group, send email to express-js@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/express-js?hl=en.
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> kadir.
>>> -- http://twitter.com/kadirpekel
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Express" group.
>>> To post to this group, send email to express-js@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/express-js?hl=en.
>>>
>>
>>
>>
>> --
>> Tj Holowaychuk
>> Vision Media
>> President & Creative Lead
>>
>
>
>
> --
> Tj Holowaychuk
> Vision Media
> President & Creative Lead
>
> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To post to this group, send email to express-js@googlegroups.com.
> To unsubscribe from this group, send email to
> express-js+unsubscribe@googlegroups.com<express-js%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/express-js?hl=en.
>



-- 

kadir.
-- http://twitter.com/kadirpekel

--001636832ef4602dd1048c5f5fa7
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

As a module, knowing about its parent is less &#39;modular&#39; i think. Th=
e two of your approachs seems fine, but as a convention i&#39;d rather pref=
er module to know nothing about any parent candidate and better waiting for=
 milk from any of them :)<br>
<br>However, it rocks anyway, it&#39;s some sort of tastes within the freed=
om of javascript world.<br><br><br><div class=3D"gmail_quote">On Tue, Jul 2=
7, 2010 at 5:07 PM, vision media [ Tj Holowaychuk ] <span dir=3D"ltr">&lt;<=
a href=3D"mailto:t...@vision-media.ca">t...@vision-media.ca</a>&gt;</span> wrot=
e:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">hell you might ev=
en want to module.exports =3D function(app){ app.get(...) }<div><br></div><=
div>
and then require(&#39;./foobar&#39;)(app)</div><div><br></div><div>explicit=
ly passing your app instance</div><div><div></div><div class=3D"h5"><div><b=
r><div class=3D"gmail_quote">
On Tue, Jul 27, 2010 at 7:06 AM, vision media [ Tj Holowaychuk ] <span dir=
=3D"ltr">&lt;<a href=3D"mailto:t...@vision-media.ca" target=3D"_blank">tj@vis=
ion-media.ca</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);=
 padding-left: 1ex;">

The example is not magic at all if your used to node modules, I would not c=
all<div>it=A0elegant=A0but the point is nothing is imposed, any way you cho=
ose to get your</div><div>app from one module to another is fine :)<div><di=
v>

</div><div><br><br><div class=3D"gmail_quote">
On Tue, Jul 27, 2010 at 5:47 AM, Kadir Pekel <span dir=3D"ltr">&lt;<a href=
=3D"mailto:kadirpe...@gmail.com" target=3D"_blank">kadirpe...@gmail.com</a>=
&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
t 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1=
ex;">


+1 for Hecmann&#39;s<br><br>My humble opinion is doing it with less magic f=
or more understandable and acceptable structure.<br><br>thnks.<div><div></d=
iv><div><br><br><div class=3D"gmail_quote">On Tue, Jul 27, 2010 at 3:25 PM,=
 Aaron Heckmann <span dir=3D"ltr">&lt;<a href=3D"mailto:aaron.heckmann@gmai=
l.com" target=3D"_blank">aaron.heckm...@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">The only other op=
tion I see is to export a method from your child module that accepts an app=
 instance which you then use to wire up routes - and that is far less elega=
nt.<br>




<div><div></div><div><br>
On Jul 26, 2010, at 11:14 PM, &quot;Jeffrey &#39;jf&#39; Lim&quot; &lt;<a h=
ref=3D"mailto:jfs.wo...@gmail.com" target=3D"_blank">jfs.wo...@gmail.com</a=
>&gt; wrote:<br>
<br>
&gt; yeah thanks, guys! this is precisely what I&#39;m looking for (althoug=
h<br>
&gt; yes :), a more elegant way would be great... But hey, it works!!!) - a=
<br>
&gt; way to be able to refer to &#39;app&#39; in require-d files... And Kad=
ir, I am<br>
&gt; subscribed. I just missed out on that thread. Thanks for pointing it<b=
r>
&gt; out!!!<br>
&gt;<br>
&gt; -jf<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jul 27, 2010 at 12:04 AM, vision media [ Tj Holowaychuk ]<br>
&gt; &lt;<a href=3D"mailto:t...@vision-media.ca" target=3D"_blank">tj@vision-=
media.ca</a>&gt; wrote:<br>
&gt;&gt; The parent module reference is a bit weird I know, but it works ju=
st fine. I<br>
&gt;&gt; would love<br>
&gt;&gt; suggestions for a clear way to do this, but you cant just simply<b=
r>
&gt;&gt; require(&#39;./app&#39;) or similar<br>
&gt;&gt; because you will cause a cyclic require and segfault :) this is th=
e best<br>
&gt;&gt; approach I have come<br>
&gt;&gt; up with<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Jul 26, 2010 at 6:18 AM, Kadir Pekel &lt;<a href=3D"mailto=
:kadirpe...@gmail.com" target=3D"_blank">kadirpe...@gmail.com</a>&gt; wrote=
:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi Jeffrey,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; It was also discussed yesterday.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; <a href=3D"http://groups.google.com/group/express-js/browse_th=
read/thread/80f21aba4cb54e58#" target=3D"_blank">http://groups.google.com/g=
roup/express-js/browse_thread/thread/80f21aba4cb54e58#</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; You&#39;d better subscribe to group if you are really interest=
ed in :)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Good luck with Express.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Mon, Jul 26, 2010 at 3:19 PM, Aaron Heckmann &lt;<a href=3D=
"mailto:aaron.heckm...@gmail.com" target=3D"_blank">aaron.heckm...@gmail.co=
m</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I believe what you&#39;re looking for is in the blog examp=
le:<br>
&gt;&gt;&gt;&gt; <a href=3D"http://github.com/visionmedia/express/blob/mast=
er/examples/blog/app.js" target=3D"_blank">http://github.com/visionmedia/ex=
press/blob/master/examples/blog/app.js</a><br>
&gt;&gt;&gt;&gt; In app.js, the server instance is assigned to module.expor=
ts so that<br>
&gt;&gt;&gt;&gt; child modules have access to &quot;app&quot; (the server) =
as well.<br>
&gt;&gt;&gt;&gt; Now take a peek at contact.js<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; <a href=3D"http://github.com/visionmedia/express/blob/mast=
er/examples/blog/contact.js" target=3D"_blank">http://github.com/visionmedi=
a/express/blob/master/examples/blog/contact.js</a><br>
&gt;&gt;&gt;&gt; Here you see how to set up routes in child modules by acce=
ssing<br>
&gt;&gt;&gt;&gt; &quot;module.parent.exports&quot; which is the &quot;app&q=
uot; in app.js.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Mon, Jul 26, 2010 at 6:33 AM, Sam Millman &lt;<a href=
=3D"mailto:smill...@nhbs.co.uk" target=3D"_blank">smill...@nhbs.co.uk</a>&g=
t; wrote:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; require should work both ways since it just includes t=
he page code into<br>
&gt;&gt;&gt;&gt;&gt; the current document then it is upto you to instantiat=
e the object yourself.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On 26 July 2010 11:29, Sam Millman &lt;<a href=3D"mail=
to:smill...@nhbs.co.uk" target=3D"_blank">smill...@nhbs.co.uk</a>&gt; wrote=
:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; you mean:<br>
&gt;&gt;&gt;&gt;&gt;&gt; require(&quot;sys&quot;);<br>
&gt;&gt;&gt;&gt;&gt;&gt; or:<br>
&gt;&gt;&gt;&gt;&gt;&gt; require(&quot;./mongod/somecheeseyclassthatIwantin=
cluded&quot;)<br>
&gt;&gt;&gt;&gt;&gt;&gt; In turn this allows you to propogate a class. Is t=
his what you mean or<br>
&gt;&gt;&gt;&gt;&gt;&gt; do you meant the php include where it acts as a pa=
rt of the file?<br>
&gt;&gt;&gt;&gt;&gt;&gt; so:<br>
&gt;&gt;&gt;&gt;&gt;&gt; require(&quot;sys&quot;) would mean the code of th=
at file is placed into the<br>
&gt;&gt;&gt;&gt;&gt;&gt; current document allowing the code to be manipulat=
ed as if it wasnt in a<br>
&gt;&gt;&gt;&gt;&gt;&gt; different file?<br>
&gt;&gt;&gt;&gt;&gt;&gt; On 26 July 2010 09:54, Jeffrey &#39;jf&#39; Lim &l=
t;<a href=3D"mailto:jfs.wo...@gmail.com" target=3D"_blank">jfs.world@gmail.=
com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Anybody wondered about this? I come from a sin=
atra background :), and<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; I very much like the ability to be able to arb=
itrarily split off<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; related functionality/code into different file=
s (eg. I want to split<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; off the &quot;app.get(&#39;/user/xxx&#39;, ...=
)&quot; stuff into another file, say<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; users.js). In sinatra, you could do this with =
a &#39;require&#39;.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Unfortunately, this doesnt seem possible with =
node/expressjs. Or is<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; there something i&#39;m missing? Does anybody =
miss/want this<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; functionality?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; -jf<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; &quot;Every nonfree program has a lord, a mast=
er --<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; and if you use the program, he is your master.=
&quot;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; =A0 =A0 --Richard Stallman<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; &quot;It&#39;s so hard to write a graphics dri=
ver that open-sourcing it would<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; not help.&quot;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; =A0 =A0 -- Andrew Fear, Software Product Manag=
er, NVIDIA Corporation<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href=3D"http://kerneltrap.org/node/7228" ta=
rget=3D"_blank">http://kerneltrap.org/node/7228</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; You received this message because you are subs=
cribed to the Google<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Groups &quot;Express&quot; group.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; To post to this group, send email to <a href=
=3D"mailto:express-js@googlegroups.com" target=3D"_blank">express-js@google=
groups.com</a>.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; To unsubscribe from this group, send email to<=
br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href=3D"mailto:express-js%2Bunsubscribe@goo=
glegroups.com" target=3D"_blank">express-js+unsubscribe@googlegroups.com</a=
>.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; For more options, visit this group at<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href=3D"http://groups.google.com/group/expr=
ess-js?hl=3Den" target=3D"_blank">http://groups.google.com/group/express-js=
?hl=3Den</a>.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt;&gt; Bow Chicka Bow Wow<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt; Bow Chicka Bow Wow<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt; You received this message because you are subscribed t=
o the Google<br>
&gt;&gt;&gt;&gt;&gt; Groups &quot;Express&quot; group.<br>
&gt;&gt;&gt;&gt;&gt; To post to this group, send email to <a href=3D"mailto=
:express-js@googlegroups.com" target=3D"_blank">express-js@googlegroups.com=
</a>.<br>
&gt;&gt;&gt;&gt;&gt; To unsubscribe from this group, send email to<br>
&gt;&gt;&gt;&gt;&gt; <a href=3D"mailto:express-js%2Bunsubscribe@googlegroup=
s.com" target=3D"_blank">express-js+unsubscribe@googlegroups.com</a>.<br>
&gt;&gt;&gt;&gt;&gt; For more options, visit this group at<br>
&gt;&gt;&gt;&gt;&gt; <a href=3D"http://groups.google.com/group/express-js?h=
l=3Den" target=3D"_blank">http://groups.google.com/group/express-js?hl=3Den=
</a>.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt; Aaron<br>
&gt;&gt;&gt;&gt; <a href=3D"http://clickdummy.net" target=3D"_blank">http:/=
/clickdummy.net</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt; You received this message because you are subscribed to th=
e Google Groups<br>
&gt;&gt;&gt;&gt; &quot;Express&quot; group.<br>
&gt;&gt;&gt;&gt; To post to this group, send email to <a href=3D"mailto:exp=
ress-js@googlegroups.com" target=3D"_blank">express-js@googlegroups.com</a>=
.<br>
&gt;&gt;&gt;&gt; To unsubscribe from this group, send email to<br>
&gt;&gt;&gt;&gt; <a href=3D"mailto:express-js%2Bunsubscr...@googlegroups.co=
m" target=3D"_blank">express-js+unsubscribe@googlegroups.com</a>.<br>
&gt;&gt;&gt;&gt; For more options, visit this group at<br>
&gt;&gt;&gt;&gt; <a href=3D"http://groups.google.com/group/express-js?hl=3D=
en" target=3D"_blank">http://groups.google.com/group/express-js?hl=3Den</a>=
.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; Kadir Pekel<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; You received this message because you are subscribed to the Go=
ogle Groups<br>
&gt;&gt;&gt; &quot;Express&quot; group.<br>
&gt;&gt;&gt; To post to this group, send email to <a href=3D"mailto:express=
-js@googlegroups.com" target=3D"_blank">express-js@googlegroups.com</a>.<br=
>
&gt;&gt;&gt; To unsubscribe from this group, send email to<br>
&gt;&gt;&gt; <a href=3D"mailto:express-js%2Bunsubscribe@googlegroups.com" t=
arget=3D"_blank">express-js+unsubscribe@googlegroups.com</a>.<br>
&gt;&gt;&gt; For more options, visit this group at<br>
&gt;&gt;&gt; <a href=3D"http://groups.google.com/group/express-js?hl=3Den" =
target=3D"_blank">http://groups.google.com/group/express-js?hl=3Den</a>.<br=
>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Tj Holowaychuk<br>
&gt;&gt; Vision Media<br>
&gt;&gt; President &amp; Creative Lead<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; You received this message because you are subscribed to the Google=
 Groups<br>
&gt;&gt; &quot;Express&quot; group.<br>
&gt;&gt; To post to this group, send email to <a href=3D"mailto:express-js@=
googlegroups.com" target=3D"_blank">express-js@googlegroups.com</a>.<br>
&gt;&gt; To unsubscribe from this group, send email to<br>
&gt;&gt; <a href=3D"mailto:express-js%2Bunsubscribe@googlegroups.com" targe=
t=3D"_blank">express-js+unsubscribe@googlegroups.com</a>.<br>
&gt;&gt; For more options, visit this group at<br>
&gt;&gt; <a href=3D"http://groups.google.com/group/express-js?hl=3Den" targ=
et=3D"_blank">http://groups.google.com/group/express-js?hl=3Den</a>.<br>
&gt;&gt;<br>
&gt;<br>
&gt; --<br>
&gt; You received this message because you are subscribed to the Google Gro=
ups &quot;Express&quot; group.<br>
&gt; To post to this group, send email to <a href=3D"mailto:express-js@goog=
legroups.com" target=3D"_blank">express-js@googlegroups.com</a>.<br>
&gt; To unsubscribe from this group, send email to <a href=3D"mailto:expres=
s-js%2Bunsubscribe@googlegroups.com" target=3D"_blank">express-js+unsubscri=
be@googlegroups.com</a>.<br>
&gt; For more options, visit this group at <a href=3D"http://groups.google.=
com/group/express-js?hl=3Den" target=3D"_blank">http://groups.google.com/gr=
oup/express-js?hl=3Den</a>.<br>
&gt;<br>
<br>
</div></div>--<br>
<div><div></div><div>You received this message because you are subscribed t=
o the Google Groups &quot;Express&quot; group.<br>
To post to this group, send email to <a href=3D"mailto:express-js@googlegro=
ups.com" target=3D"_blank">express-js@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:express-js%=
2Bunsubscribe@googlegroups.com" target=3D"_blank">express-js+unsubscribe@go=
oglegroups.com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/express-js?hl=3Den" target=3D"_blank">http://groups.google.com/group/e=
xpress-js?hl=3Den</a>.<br>
<br>
</div></div></blockquote></div><br><br clear=3D"all"><br></div></div>-- <br=
><br>kadir.<br>-- <a href=3D"http://twitter.com/kadirpekel" target=3D"_blan=
k">http://twitter.com/kadirpekel</a><br><font color=3D"#888888"><br>

<p></p>

-- <br></font><div><div></div><div>
You received this message because you are subscribed to the Google Groups &=
quot;Express&quot; group.<br>
To post to this group, send email to <a href=3D"mailto:express-js@googlegro=
ups.com" target=3D"_blank">express-js@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:express-js%=
2Bunsubscribe@googlegroups.com" target=3D"_blank">express-js+unsubscribe@go=
oglegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/express-js?hl=3Den" target=3D"_blank">http://groups.google.com/group/e=
xpress-js?hl=3Den</a>.<br>


</div></div></blockquote></div><br><br clear=3D"all"><br></div></div>-- <br=
><div>Tj Holowaychuk<br>Vision Media<br>President &amp; Creative Lead<br>
</div></div>
</blockquote></div><br><br clear=3D"all"><br>-- <br>Tj Holowaychuk<br>Visio=
n Media<br>President &amp; Creative Lead<br>
</div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Express&quot; group.<br>
To post to this group, send email to <a href=3D"mailto:express-js@googlegro=
ups.com" target=3D"_blank">express-js@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:express-js%=
2Bunsubscribe@googlegroups.com" target=3D"_blank">express-js+unsubscribe@go=
oglegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/express-js?hl=3Den" target=3D"_blank">http://groups.google.com/group/e=
xpress-js?hl=3Den</a>.<br>


</div></div></blockquote></div><br><br clear=3D"all"><br>-- <br><br>kadir.<=
br>-- <a href=3D"http://twitter.com/kadirpekel" target=3D"_blank">http://tw=
itter.com/kadirpekel</a><br><br>

--001636832ef4602dd1048c5f5fa7--