A quick and dirty way is to wrap express.static middleware. You can try
something like:

app.use(function(req, res, next){
   // do authentication
   if(authorized){
      express.static("/private")(req, res, next);
   } else {
     next();
}

On Thu, Aug 30, 2012 at 9:16 AM, AndDM <anddima...@gmail.com> wrote:

> Hi, really thanks, i'm trying with this, but it seems that have problems
> with rendering, for jpg it tells me that have errors and for style and html
> i've enconding errors too.
>
> [image: The image “https://localhost:10443/static/private/img.jpg” cannot be 
> displayed because it contains errors.]
> Have you some suggestions?
>
> [image: The image “https://localhost:10443/static/private/img.jpg” cannot
> be displayed because it contains errors.]Thanks for your time.
> Best regards
>
>
> On Thursday, August 30, 2012 11:17:21 AM UTC+2, Weltschmerz wrote:
>>
>> You could try such an approach:
>>
>> https://gist.github.com/**3524676 <https://gist.github.com/3524676>
>>
>> On Thursday, August 30, 2012 2:10:47 AM UTC-5, AndDM wrote:
>>>
>>> Hi, i'm working on an Express application that has to type of static
>>> content (image, css, js ecc): private and public.
>>> For public there're not problems, but for private i'm looking for a
>>> solutions, these file must be read only by authenticated user. For now i'm
>>> trying to get all from filesystem with fs library, but i'm looking for
>>> simply solutions.
>>>
>>> Have you some suggestions to solve this problem?
>>>
>>> Thanks for your time.
>>> Best regards.
>>>
>>  --
> 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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to