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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:36:22+00:00 2026-06-10T11:36:22+00:00

I am using expressJs 3.x and node 0.8.8. In my application I tried to

  • 0

I am using expressJs 3.x and node 0.8.8. In my application I tried to catch all invalid urls. So I have added the following code. It is working fine, it is also catching the url, if I try to access the public or static files.

app.all('/*', function(req, res){
    \\ Do some action like redirecting or whatever ...
});

How to avoid or pass static folder files (GET Request) and how to catch only invalid urls ?

  • 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-10T11:36:24+00:00Added an answer on June 10, 2026 at 11:36 am

    Most likely, you’re calling app.use(app.router) prior to app.use(express.static(...)), so that express tries to find matching route first, and only if there is no matched route it tries to find the corresponding static files.

    The configuration code should be like that:

    app.configure(function () {
        app.use(express.static(__dirname + '/public'));
        app.use(app.router);
    });
    

    so that express will try to find a static file first.

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

Sidebar

Related Questions

I'm using ExpressJs with Node.js and have put all my routes into a 'routes'
I'm using Expressjs w/ node.js and I have a route like this: users.init(app.db, function()
I have the following express node.js app. It's using the 'redis' npm package. app.get(/test,function(req,res){
I'm creating an application using Expressjs running on node under IISNode (i.e on windows).
I have a node.js application using Express and Redis. My question is how do
I have built my application using node.js, mongodb, redis, express, socket.io and planning to
Using node.js / expressjs / mongoose / mongoose-auth / everyauth. All versions are up
I am using node.js + express.js + everyauth.js. I have moved all my everyauth
I have the following Node.js code: var express = require('express'); var app = express.createServer(express.logger());
I have the following in my node server using Express (truncated to the important

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.