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

The Archive Base Latest Questions

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

I am building a Node Express application using Jade, and I am confused about

  • 0

I am building a Node Express application using Jade, and I am confused about how to route my views to the specific requests the browser will make. I understand that in order to get URLs to work in the browser, we need to use Node’s routes; however, from looking online, I have discovered that Express has its own router.

I used PHPStorm to start up my project, and the index.jade will load… but how do I load the others? Here is my existing code:

var express = require('express'), routes = require('./routes'), http = require('http'), path = require('path');

var app = express();

app.configure(function ()
{
    app.set('port', process.env.PORT || 3000);
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
    app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.cookieParser('your secret here'));
    app.use(express.session());
    app.use(app.router);
    app.use(require('less-middleware')({ src:__dirname + '/public' }));
    app.use(express.static(path.join(__dirname, 'public')));
});

app.configure('development', function ()
{
    app.use(express.errorHandler());
});

app.get('/', routes.index);

http.createServer(app).listen(app.get('port'), function ()
{
    console.log("Express server listening on port " + app.get('port'));
});

What is the most basic way to route my application, and where can I find more extensive documentation on this topic?

Thanks.

  • 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-10T02:22:50+00:00Added an answer on June 10, 2026 at 2:22 am

    I understand that in order to get URLs to work in the browser,
    we need to use Node’s routes; however, from looking online,
    I have discovered that Express has its own router.

    Node.js per-se does not provide support for “routes”, but Express does. You build your routes in Express using the following syntax:

    app.[verb]('[url-path]', [handler]);
    

    So your route app.get(‘/’, routes.index) will process HTTP GET request to URL path / with the routes.index function. Express will automatically pass a request and response objects to your handler.

    You can add more routes like this:

    app.get('/users', routes.userList);
    app.get('/user/:id', routes.userInfoView);
    app.post('/user/:id', routes.userInfoSave);
    

    You can find more information about this here http://expressjs.com/api.html#app.param

    I am building a Node Express application using Jade, and I
    am confused about how to route my views to the specific
    requests the browser will make.

    Once a route handler is invoked, say (routes.userList) you can call res.render() method inside userList to render the Jade file that you want. For example:

    res.render('user_list', 
        { users: [{name: "user1", age: 10}, {name: "user2", age: 20}] });
    

    See here for more information: http://expressjs.com/api.html#res.render

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

Sidebar

Related Questions

I am building an ASP.NET web application that will be deployed to a 4-node
I'm building one page application using Backbone's router to modify browser history. I don't
I am building an app on node.js using express, and node-mysql driver. There is
I'm currently building a realtime application using Node. I'm using socket.io to power my
I'm following this tutorial about building a blog with node.js, express and mongodb. The
I am building a real-time multi-player browser-based game using node.js. At the moment I
Alright, so I'm building an application based in Node.js and I am using mongoose
I am building a website/app using node.js, express and nowjs. Once user log into
I'm building an app with backbone/RequireJs on the front end and node/express on the
I'm building an app in Backbone using Node as the backend. As part of

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.