Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden files/folders #211

Open
brettz9 opened this issue Jul 14, 2018 · 4 comments
Open

Hidden files/folders #211

brettz9 opened this issue Jul 14, 2018 · 4 comments

Comments

@brettz9
Copy link
Collaborator

brettz9 commented Jul 14, 2018

Is there any means, whether through a generic filter by file name, or by config specifically targeting hidden files/folders, that one may prevent/enable hidden files from being served? Thanks!

@vovchisko
Copy link

vovchisko commented Jul 16, 2018

Let's say "sometimes" you don't want to serve something.

require('http').createServer(function (request, response) {
    request.addListener('end', function () {
        // Serve files! ... or not?
        if(request.url.includes('mom')) {
             nodeStatic.serveFile('/nothing-about-mom.html', 404, {}, request, response);
         }
         nodeStatic.serve(request, response);
    }).resume();
}).listen(8080);

@brettz9
Copy link
Collaborator Author

brettz9 commented Jul 16, 2018

Yes, sure, thanks--I should have mentioned though that I was hoping for a CLI option...

@vovchisko
Copy link

@brettz9 at least I don't see anything here https://github.com/cloudhead/node-static/blob/master/bin/cli.js

@brettz9
Copy link
Collaborator Author

brettz9 commented Nov 22, 2018

This would be particularly helpful for an easy means to set up production static servers on the root of one's repository without fear of exposing .git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants