Link in terminal

1

Is there any way to do that when the localhost:3000 , which is in the terminal, is pressed ctrl + click the browser is opened in the page in question ( localhost : 3000 ) ... this in a Javascript code:

console.log('\nServidor iniciado em 3[36mlocalhost:30003[37m\n')

Obs : I searched but only found references on how to create a link in Html <a> : ( </a>

    
asked by anonymous 20.01.2018 / 00:02

1 answer

1

I believe that shortcut is not possible, but you can execute command to open. Below are examples when running:

npm start

It will automatically open the browser after starting the App . Add one of the codes below in the package.json of your project.

Linux :

"scripts": {
    "start": "node app.js && xdg-open http://localhost:3000"
}

Mac :

"scripts": {
    "start": "node app.js && open http://localhost:3000"
}

Windows :

"scripts": {
    "start": "node app.js && start http://localhost:3000"
}
    
20.01.2018 / 00:30