This forum has moved, please join us on github discussions. We will keep these old posts available for reference. Thank you!

How to change the port

Hey apostrophe team,

this is really the dumbest question I have to ask but there is really no good documentation on here how to change the running port for express.

Even this guide gives me only that I should run multiple instances on different ports, but how? Its not a technical question how this works (I know) its just always listening on 3000.

How can I configure it in local.js?
How is this configured in app.js?

I tried (in app.js) :

var apos = require('apostrophe')({ 
  shortName: 'website',
  // baseUrl: 'http://example.com',
  port: 8123,
  forcePort: 8123,
....

or even with node app.js --port 8123

Please put it in the documentation what the correct way is. I wont be using Stagecoach.

Best wishes

Edit:

Never mind, in local.js it does really work. For anyone who searches it via google and comes up empty:

‘apostrophe-express’: {
port: 8123
}

Hi breef, data/local.js is indeed one way:

module.exports = {
  modules: {
    'apostrophe-express': {
      port: nnnn
    }
  }
};

If you start up a recent version of Apostrophe, you’ll also be told about other ways, notably the PORT environment variable.