Skip to content

Instantly share code, notes, and snippets.

@dhilt
Created May 4, 2020 04:15
Show Gist options
  • Save dhilt/c1863af8b34e8c697d77951689a78e05 to your computer and use it in GitHub Desktop.
Save dhilt/c1863af8b34e8c697d77951689a78e05 to your computer and use it in GitHub Desktop.
Angular cli dev server port via .env // node script
const dotenv = require('dotenv');
const child_process = require('child_process');
const config = dotenv.config()
const DEV_SERVER_PORT = process.env.DEV_SERVER_PORT || 4200;
const child = child_process.exec(`ng serve --port=${DEV_SERVER_PORT}`);
child.stderr.on('data', err => console.error(err));
child.stdout.on('data', data => console.log(data.toString()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment