Hi Gus,


Use two instances of the express.static middleware:


var path = require('path'),

    express = require('express'),

    app = express.createServer(),

    root = '/path/to/my/app'; // Better: path.resolve(__dirname, 'relativePath')

app

    .use('/uploads', express.static(path.resolve(root, 'app.uploads')))
    .use(express.static(path.resolve(root, 'app.www')));


Best regards,
Andreas Lind Petersen (papandreou)

On Tuesday, August 7, 2012 5:18:37 PM UTC+2, Gustavo Machado wrote:

> Hi, 
>
> I am using the following folder structure for an expressjs website: 
>
> /app.www 
> /app.uploads 
>
> I would like to use the static middleware to server the files in the 
> app.uploads folder, but with the following prefix: "/uploads": 
>
> http://localhost:3000/b.jpg <-- /app.www/b.jpg 
> http://localhost:3000/uploads/b.jpg <-- /app.uploads/b.jpg 
>
> (Obviously I would like to keep the uploads folder outside of the www 
> folder) 
>
> Any ideas? 
>
> Thanks, 
> Gus 
>

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