you'll have more luck in the express-js google group, but yes static()
supports nesting like the others mentioned, the pathname is basically
appended to the root path you give static(), so the following is very
typical:

*app.use(express.static(__dirname + '/public')); *

On Friday, 27 July 2012 08:58:45 UTC-7, divin sorcier wrote:
>
>
> I am facing troubles with unresolved static resources access, while I use 
> Express and node.js under Windows 7 environment. 
>
> Code is really basic and simple - see below. 
>
> // file app.js
> *var express = require('express'); 
> var app = express.createServer(); 
>
> app.configure(function() {
>     app.use(express.methodOverride());
>     app.use(express.bodyParser());
>     app.use(express.logger());
>     app.use('/css', express.static(__dirname + '/static/css')); 
> });
>
> app.configure('development', function() {
>     app.use(express.errorHandler({
>         dumpExceptions: true,
>         showStack: true
>         }));
> });
>
> app.configure('production', function() {
>     app.use(express.errorHandler());
> });
>
> app.set('views', __dirname + '/views');
> app.set('view engine', 'jade');
>
> app.get('/', function(req, res) {
>     res.render('root', { layout: 'layout' } );
> });
>
> app.listen(9766, '127.0.0.1');
>
>
> // file views/layout.jade 
> !!! 5
> html
>     head
>         link(rel='stylesheet', href='/css/styles.css')
>         link(rel='favicon', href='/img/favicon_feed.png')
>         title My template
>     body
>         #main
>             h1    Content goes here
>             #container!= body
>
> // file static/css/styles.css 
> body {
>     font-family: Helvetica, Arial, Sans-Serif; 
>     font-size: 14px;
> }
>
> // file views/root.jade
> h2 Test Case Repository App
> p Feed 
>
> #main {
>     width: 960px;
>     margin: 0 auto;
>     border: 1px solid #ddd; 
>     padding: 1em; 
> }
> *
> // dependencies tree
> c:\projets\node\advanced>npm ls
> c:\projets\node\advanced
> ├─┬ [email protected]
> │ ├── [email protected]
> │ ├─┬ [email protected]
> │ │ ├── [email protected]
> │ │ ├── [email protected]
> │ │ ├── [email protected]
> │ │ └── [email protected]
> │ ├── [email protected]
> │ ├── [email protected]
> │ ├── [email protected]
> │ ├── [email protected]
> │ ├── [email protected]
> │ ├── [email protected]
> │ ├── [email protected]
> │ └─┬ [email protected]
> │   └── [email protected]
> └─┬ [email protected]
>   ├── [email protected]
>   └── [email protected]
>
> c:\projets\node\advanced>node --version
> v0.8.1
>
> Help welcome - I am stuck. Tried several things but I have to admit it, 
> the root cause is escaping my investigations! 
>
>
>

-- 
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

Reply via email to