Mejoramos la app [operations](Calculator Node) y la modificamos para recoger directamente argumentos desde Node
If we want ignored any file for Git, must be create a file whit the name .gitignore
and into put the name of the folders and files for ignore the Git
Si introducimos en consola el comando env
, obtenemos todas las variables de entorno de nuestro sistema operativo y podemos leerla mediante Node.
Por ejemplo con el set MY_name=Toni&&node app.js
podremos modificar alguna variable de entorno que hemos visto anteriormente.
Lo podremos ver si en nuestra app escribimos un console.log, como el siguiente.
console.log(process.env)
y veremos como la variable de entorno a cambiado al lanzar el comando
// set MY_NAME=Toni&&node app.js
Now checked the next exercise [Node Exercises](Node Exercises). In this exercises up the litle server listening on port that in the moment of launch the app is specificy in the moment you call the node app. On windows with the next command set PORT=3000&&node app.js
Modulo request
- Generate the file package.json with this command in console
npm ini
- Install dependencies,
npm install request
if add the command--save
automaticaly update the package.json with the new package. - Create the file for request HTML webpages:
var request = require('request')
request('http://www.google.com', function (error, response, body) {
console.log('error:', error) // Print the error if one occurred
console.log('statusCode:', response && response.statusCode) // Print the response status code if a response was received
console.log('body:', body) // Print the HTML for the Google homepage.
})
- Node Exercises Folder
- Connection to the server
- Show Content
- HTML Code
- File list
- Writing on txt
- Demo Async examples
Exercises: Demo Get Url Request
Practice with node https://nodeschool.io/
npm install learyounode
- Video | Understanding asynchronous tasks
- Article | Asynchronous Code Design With Node.js
- Tutorial | Short Intro to Node