Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I serve my localhost from a different port other than 4200 in EmberJS?

Tags:

ember.js

Normally, when a user calls

ember serve

The local host is always 4200 by default. It would be nice if I could specify a different port so that I could have two ember web apps running. Is it possible to have a ember serve a different port?

The reason I care is that I'm using one of my web apps to help me build the other, and it would be convenient to have them both running at the same time so that I don't keep going back and forth with my builds.

like image 424
Cameron Avatar asked Dec 08 '22 18:12

Cameron


2 Answers

yeah, of course, you can! you can either pass the --port arg directly to the serve command as - ember serve --port=4201 or else you can specify in the .ember-cli file (will be present in your root directory) as follow

{
  /**
    Ember CLI sends analytics information by default. The data is completely
    anonymous, but there are times when you might want to disable this behavior.

    Setting `disableAnalytics` to true will prevent any data from being sent.
  */
  "disableAnalytics": false,
  "port": 4201
}

if you mention this in .ember-cli file, then ember serve will run in the specified port by default.

like image 182
Gokul Kathirvel Avatar answered Dec 10 '22 06:12

Gokul Kathirvel


Yes, you can specify the ports for your ember apps:

ember server --port 1234 --live-reload-port 1235
like image 27
H.yum Avatar answered Dec 10 '22 06:12

H.yum