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 9115439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:25:58+00:00 2026-06-17T04:25:58+00:00

I have widgets which include both client & and server .coffee files (think of

  • 0

I have “widgets” which include both client & and server .coffee files (think of client as a Backbone.js model/view and server as the correlating ExpressJS routes), all under the root project:

my-node-expressjs3-project/
  src/
    widget1/
      client/
        app.coffee
      server/
        routes.coffee
    widget2/
      client/
        app.coffee
      server/
        routes.coffee
  app/
    widget1/
      client/
        app.js 
      server/
        routes.js
    widget2/
      client/
        app.js 
      server/
        routes.js
  public/

All .coffee files compile to app/. I am trying to keep the widgets referentially intact, and just allow the client/ folder to be served for “widgets”. Problem 1 – I can’t get it to work. Problem 2 – if 2 widgets contain the same app.js file, they would appear the same under the way I thought to solve the problem:

app.use express['static'](__dirname + '/public')
app.use express['static'](__dirname + '/app/*/client/')

How would I do this?

  • 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-17T04:25:59+00:00Added an answer on June 17, 2026 at 4:25 am

    Regarding problem one, node doesn’t have a built-in way to search a filesystem like this using globbing. If you have non-widgety things in your app directory you will need to filter them out manually, or you can use something like the awesome node-findit package.

    Regarding problem two, once you have the list of widgets, you can just mount the static middleware at that subUrl for each widget. The app.use function takes an optional mount path.

    var widgetDirs = fs.readdirSync('app');
    
    widgetDirs.forEach(function(widgetDir) {
        app.use(widgetDir, express.static(__dirname + '/app/' + widgetDir + '/client/'));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which must save client instances of com.smartgwt.client.widgets.Canvas to a disk
I have a User model, which :has_many :widgets Here is the 'edit' method: def
I have a wx.Frame, in which there is a main wx.Panel with several widgets
I did mockups in balsamiq & they have this nice widget, which Allowed to
I have an app on the market which supports widgets. I've made some heavy
I have this little test-case which is supposed to show two widgets, with one
I have a plugin from a supplier, which i can only include in my
i have set up a demo which use iframe to include an target webpage
While developing widgets (objects, which - rendered - use some custom javascript files), I
I have a JavaScript widget which communicates with my Rails app by creating tags

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.