Configure browserSync with nodejs server
<p>I need help in understanding how to configure the ports for node server and browser-sync. </p>

<p>Within the serevr.js file, the http server is listening on port 3006;
    <code>server.listen(3006);</code></p>

<p>I would like browsersync to open the browser and point the address to server port <code>3006</code>. This is the port the http server listening to. So the address would be <code>localhost:3006</code></p>

<p><strong>gulpfile.js</strong></p>

<pre><code>gulp.task('serve', function() {
browserSync.init({
    server: {
        baseDir: './dist/'
    },
    port: 3006
 });
});
</code></pre>

<ol>
<li><p>In the mac terminal, I run<code>gulp</code>. This opens the browser to <code>localhost:3006</code>. Fine.</p></li>
<li><p>In another terminal window, I start the node server, <code>nodemon dist/serevr.js</code></p></li>
</ol>

<p>I'm unable to get them to be the same. Either the server will not start because something is already running on port 3006, (step 1), or, the following happens if I start the server first. </p>

<hr>

<pre><code>Local: http://localhost:3007
External: http://192.168.1.63:3007
</code></pre>

<hr>

<p>How can I get them to work together?</p>

<p><strong>Solution found with help from answers below:</strong></p>

<pre><code>gulp.task('serve', function() {
    browserSync.init({
        port: 3007,
        proxy: {
            target: "localhost:3006",
            ws: true
        }
    });
});
</code></pre>