replace:

  app.use('/css', express.static(__dirname + '/static/css'));

with:

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

and try again.


On Fri, Jul 27, 2012 at 5:58 PM, divin sorcier <[email protected]> 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



-- 
Oliver Leics @ G+
https://plus.google.com/112912441146721682527

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