Screencasts
Home Tag Author Help

You've successfully subscribed to Codecourse Blog!

Subscribe to Codecourse Blog

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

How to change the host and port of your Nuxt apps

For whatever reason (usually CORS), you'll need to change the host and port of your local Nuxt development server at some point.

How to do it

Add the following to your package.json file under the scripts section.

"dev-host": "nuxt --hostname yourdomain.test --port 3333",

Overall, your scripts section should look like this.

"scripts": {
  "dev": "nuxt",
  "dev-host": "nuxt --hostname yourdomain.test --port 3333",
  "build": "nuxt build",
  "start": "nuxt start",
  "generate": "nuxt generate"
},

Of course, yourdomain.test can just be replaced with whatever domain you'd like to use. You can also change the name of the command from dev-host to whatever you'd prefer.

There are more ways!

Depending on your environment and preference, there are a few other ways to configure this. You'll find more over on the official Nuxt docs.