Last active
June 7, 2016 13:50
-
-
Save NataliaAvila/2b04791298c7d6c41f5d to your computer and use it in GitHub Desktop.
Node Js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PARA INICIAR NODE, ABRA O CMD, DIGITE: | |
node | |
//para verificar versão | |
node -v | |
//CRIAR SERVIDOR | |
var http = require('http'); | |
var arquivo = require('fs'); | |
var url = require('url'); | |
var server = http.createServer(function(request, response){ | |
response.writeHead(200, {"Content-Type": "text/html"}); | |
response.write("<h1>Hello World!</h1>"); | |
response.write("<br>"); | |
response.write("<h3>Aulas NodeJS</h3>"); | |
}); | |
server.listen(3000, function(){ | |
console.log('Servidor está rodando!'); | |
}); | |
//rodar arquivo no servidor: ctrl c duas vezes entra no diretorio do arquivo | |
node aula1.js | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment