Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:26:23+00:00 2026-06-13T17:26:23+00:00

In express, I can something like this to have a static server, with directory

  • 0

In express, I can something like this to have a static server, with directory index pages:

app.configure(function() {
    app.use('/mystuff', _express.static(__dirname + "/whatever/stuff"));
    app.use('/mystuff', _express.directory(__dirname + "/whatever/stuff"));
});

I would like to modify the directory index pages, by giving them different css, adding some javascript, and maybe altering the html. I prefer use as much of the existing functionality if possible, but if it is easy to just replace the whole directory middleware with my own code, that’s an option. Not sure where to start with this. Of course, I don’t want to actually edit code in the express or connect modules.

BTW, one reason for this is to workaround a bug I mentioned here: How do I set up static serving in Express with an arbitrary start path?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:26:25+00:00Added an answer on June 13, 2026 at 5:26 pm

    As you said in your comment, the express.directory functionality comes from Connect middleware; however, there doesn’t seem to be a way to set a custom file.

    As an alternative solution, you could fork Connect, change the files (located at lib/public/directory.html and lib/public/style.css), use your fork as a dependency, and do:

    var connect = require('connect');
    
    app.configure(function() {
        app.use('/mystuff', connect.static(__dirname + "/whatever/stuff"));
        app.use('/mystuff', connect.directory(__dirname + "/whatever/stuff"));
    });
    

    Instead of the express ones. I just tested this (by editing the files in node_module), and it worked.

    EDIT:
    Actually, you could probably just grab directory.js from connect and modify it and put it in your app and require() it, and then use yours instead. I haven’t tested this, but I can’t see why it wouldn’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it safe to do something like this in Node.js/Express.js? // use Object.create(null) so
Can I deploy SQL Server Express with my desktop application just like builtin database?
I'm wondering if I can use SQL Server CE instead of SQL Server Express+
I have a Silverlight 3 project with something like this: <ItemGroup> <Content Include=Content\image1.png> </Content>
I am trying to draw a figure something like this: I need to have
I have case where the class hierarchy is something like this, +---------------+ | UIElement
I have a few checkboxes representing people. Something like this: [ ] George [
This is driving me insane. I have a node app with express. It serves
I'm doing cookie session management with express with something like this: req.session.authentication = auth;
Trying to achieve something like this using recursion: if (m > n) return; Foo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.