Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23158 > unrolled thread

Trying to understand this code snippet: httpApp.use(express.static(__dirname + "/static/"));

Started byreginald.bal@gmail.com
First post2014-02-20 01:16 -0800
Last post2014-02-20 17:56 +0700
Articles 3 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Trying to understand this code snippet: httpApp.use(express.static(__dirname + "/static/")); reginald.bal@gmail.com - 2014-02-20 01:16 -0800
    Re: Trying to understand this code snippet: httpApp.use(express.static(__dirname + "/static/")); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-02-20 10:40 +0100
    Re: Trying to understand this code snippet: httpApp.use(express.static(__dirname + "/static/")); JJ <duh@nah.meh> - 2014-02-20 17:56 +0700

#23158 — Trying to understand this code snippet: httpApp.use(express.static(__dirname + "/static/"));

Fromreginald.bal@gmail.com
Date2014-02-20 01:16 -0800
SubjectTrying to understand this code snippet: httpApp.use(express.static(__dirname + "/static/"));
Message-ID<9d11d0fb-0dae-40df-aa74-628344769b41@googlegroups.com>
Regardless of the context from which I retrieved this code snippet I would like to understand following language construct.

httpApp.use(express.static(__dirname + "/static/"));

Am I right to say that a function httpApp.use is called with as argument the function express.static which on its turn uses the argument (__dirname + "/static/")?

Where can I find more information/explanation of this basic JavaScript concept?

[toc] | [next] | [standalone]


#23160

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-02-20 10:40 +0100
Message-ID<1491187.Ij1fQ0n7LW@PointedEars.de>
In reply to#23158
reginald.bal@gmail.com wrote:

> Regardless of the context from which I retrieved this code snippet I would
> like to understand following language construct.
> 
> httpApp.use(express.static(__dirname + "/static/"));
> 
> Am I right to say that a function httpApp.use is called with as argument
> the function express.static which on its turn uses the argument (__dirname
> + "/static/")?

No.

> Where can I find more information/explanation of this basic JavaScript
> concept?

<http://PointedEars.de/faq> pp.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#23161

FromJJ <duh@nah.meh>
Date2014-02-20 17:56 +0700
Message-ID<nvou32wk7fuw.11vjstb0r08j6.dlg@40tude.net>
In reply to#23158
On Thu, 20 Feb 2014 01:16:35 -0800 (PST), reginald.bal@gmail.com wrote:
> Regardless of the context from which I retrieved this code snippet I would
> like to understand following language construct. 
> 
> httpApp.use(express.static(__dirname + "/static/")); 
> 
> Am I right to say that a function httpApp.use is called with as argument
> the function express.static which on its turn uses the argument
> (__dirname + "/static/")? 

The argument is the value returned by the express.static function call, not
the express.static function itself. If the argument is the function itself,
the code would be like below, regardless of context.

httpApp.use(express.static);

> Where can I find more information/explanation of this basic JavaScript
> concept?

Here first, if you're new to JavaScript:

http://en.wikipedia.org/wiki/JavaScript

Then here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web