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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:58:35+00:00 2026-06-07T15:58:35+00:00

I am a NodeJS newbie and have a really simple question. I want to

  • 0

I am a NodeJS newbie and have a really simple question.

I want to store the port of the server in the application configuration. I use something like this to store it in the app config:

app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());

  // My configuration:
  app.set('port', 80);
});

But how can I use the value of port? I cannot find an answer in the Express documentation.

Something like console.log('Port: ' + app.get('port')); doesn’t work (TypeError: Array.prototype.toString is not generic).

Is there a better/other way to store a simple config value with the express framework?

  • 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-07T15:58:38+00:00Added an answer on June 7, 2026 at 3:58 pm

    If you use Express 2.x.x then take a look at the definition of the function set(key, value):
    https://github.com/visionmedia/express/blob/2.5.11/lib/http.js#L436

    Line 444: this.settings[setting] = val;

    So this should works:

    console.log(app.setting['port']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is a NodeJS newbie question. I would like to somehow detect if
Simple newbie question, I am starting out with nodejs, and I am pretty new
I have a simple nodejs/express application by this example. In that view there is
I have installed nodejs and mysql(also the work bench) I am building a server
New to NodeJS. Yes I know I could use a framework, but I want
Is NodeJS a good framework/codebase for a large server-side application? What I am looking
I have just started working with nodejs. I am a java script newbie. I
I want to use NodeJS or Narwhal to create a JS utility which takes
I have a nodejs server that executes commands through child_process.exec. One such command restarts
Probably a newbie question on nodejs/jsdom I am trying to scrape a website using

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.