On Sunday, February 9, 2014 10:03:14 AM UTC-8, ajlopez wrote:
>
> Sorry, partial answer here, in "bad" English.
>
> But you cannot do:
>
> require('express');
>
> only having installed global Express. You must install express as local
> module in your current app.
>
> You must run
>
> npm install express
>
> in your project top folder (where the server.js resides).
>
> Or you add express as dependency in your package.json, and run
>
> npm install
>
> It is a nuance that global and local modules are different, in general.
> But it has a justification: global installation module are for install and
> use global commands, as:
>
> express create ....
>
> (Sorry, I don't remember now the exact form, check express site)
>
> And
>
> require('express')
>
> DOES NOT look for a global express.
>
Weird. Ok, that worked. I now have my "Hello, world" express app
working. Now I have to figure out how to:
* Route most requests to serve matching files in current directory tree
* Route some requests matching particular paths to requests on other
domains with a similar path
> C'est la vie ;-)
>
> Angel "Java" Lopez
> @ajlopez
>
>
>
> On Sun, Feb 9, 2014 at 2:58 PM, David Karr <[email protected]<javascript:>
> > wrote:
>
>> I'm working on a small webapp that normally is built with a relatively
>> complex process and then deployed to WebLogic.
>>
>> However, the portion I'm working on is using AngularJS, and is all HTML
>> and Javascript. It normally makes ajax calls into another webapp on the
>> same domain. To shorten my development cycle, I'd like to avoid a build
>> process and just reload the browser page.
>>
>> I think I can do this with some combination of nodejs. It's easy enough
>> to have it run a plain web server serving the contents of any folder, but I
>> need to be able to configure it to reroute some requests to another domain.
>>
>> I get the feeling that I can do this with "express", but I'm having
>> trouble figuring it out. After I installed express globally with npm, I
>> tried just running "node server.js", where "server.js" had a
>> "require('express')". This just fails with "Error: Cannot find module
>> 'express'". Then I tried storing a "package.json" in the current directory
>> that specifies "express" as a dependency and then trying "node server.js"
>> again, but I got the same error.
>>
>> --
>> --
>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
--
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
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.