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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:37:55+00:00 2026-06-12T04:37:55+00:00

Let’s say I have the following filesystem structure: /app/ Main application folder /app.js Server

  • 0

Let’s say I have the following filesystem structure:

/app/            Main application folder
  /app.js        Server JS file ran by node.js
  /public        Folder containing files for public website (port 80)
    /index.html
    /js/
      /game.js
  /admin/        Folder containing files used by local network system (port X)
    /index.html
    /js/
      /screen.js
  /share/        Folder containing files to be used by public website OR lan
    /js/
      /jquery.js

The end result is that admin/index.html would look like:

<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/screen.js"></script>

That is, I’m loading two files from different locations. Basically, the thought here is “check if file is in /share, if not, try loading it from folder according to port”.

And here’s the current code I’m using:

var connect = require('connect'),
    sourcePublic = connect().use(
        connect.static(__dirname + '/public', { maxAge: 86400000 })
    ),
    sourceAdmin = connect().use(
        connect.static(__dirname + '/admin', { maxAge: 86400000 })
    ),
    sourceShare = connect().use(
        connect.static(__dirname + '/share', { maxAge: 86400000 })
    ),
    serverPublic = http.createServer(sourcePublic).listen(80),
    serverAdmin  = http.createServer(sourceAdmin).listen(90);
// ok, how do I use sourceShare?

PS: This system should be world-accessible through http://host/ (possibly a domain or static ip) AND accessible via the local network through http://host:90/.

While the stuff on port 90 won’t damage the system (it’s just an output screen), I’d rather if people would not be able to access it from outside (easily done by ensuring there is no port 90 forwarding between router and server).

  • 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-12T04:37:57+00:00Added an answer on June 12, 2026 at 4:37 am

    Connect middleware is stackable, so you can achieve the wanted result by simply stacking all the wanted handlers after each other.Public server gets the /public and /share handlers and admin gets the /admin and /share handlers.

    So request to public server will search for the resource under /public folder if not found there then search under /share folder. And admin server does it similarly.

    var connect = require('connect'),
        sourcePublic = connect().use(
            connect.static(__dirname + '/public', { maxAge: 86400000 })
        ).use(
            connect.static(__dirname + '/share', { maxAge: 86400000 })
        ),
        sourceAdmin = connect().use(
            connect.static(__dirname + '/admin', { maxAge: 86400000 })
        ).use(
            connect.static(__dirname + '/share', { maxAge: 86400000 })
        ),
        serverPublic = http.createServer(sourcePublic).listen(80),
        serverAdmin  = http.createServer(sourceAdmin).listen(90);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the following structure: abstract class Hand {} class Rock extends
Let me explain best with an example. Say you have node class that can
Let's say I have the following data frame: > myvec name order_no 1 Amy
Let's say I have the following object: var VariableName = { firstProperty: 1, secondProperty:
Let's say I have the following classes : public class MyProductCode { private String
Let's say I have a text file composed like this ##### typeofthread1 ##### typeofthread2
Let's say I have the following text: (example) <table> <tr> <td> <span>col1</span> </td> <td>col2</td>
Let's say I have an facebook application running using the JS SDK. First user
Let's say I have a domain object with the following field: private Map<StatType, Double>
Let say I have the following desire, to simplify the IConvertible's to allow me

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.