This repository has been archived by the owner on May 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
917 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Carrega o modulo HTTP do Node | ||
var http = require("http"); | ||
|
||
// Cria um servidor HTTP e uma escuta de requisições para a porta 8000 | ||
http.createServer((request, response) => { | ||
|
||
// Configura o cabeçalho da resposta com um status HTTP e um Tipo de Conteúdo | ||
response.writeHead(200, {'Content-Type': 'text/plain'}); | ||
|
||
// Manda o corpo da resposta "Olá Mundo" | ||
response.end('Ola Mundo\n'); | ||
}).listen(8000, '127.0.0.1'); | ||
|
||
// Imprime no console a URL de acesso ao servidor | ||
console.log('Servidor executando em http://127.0.0.1:8000/'); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// O require importa o modulo | ||
const express = require("express") | ||
const app = express(); | ||
|
||
|
||
// Rotas | ||
|
||
// Define o que acontece na root | ||
app.get("/", (req, res) => { | ||
// Resposta da rota | ||
res.end('Ola Mundo\n'); | ||
}) | ||
|
||
// Serve a pasta public para quem acessa o servidor | ||
//app.use(express.static("public")); | ||
|
||
|
||
// Inicia o Servidor na porta 8000 | ||
app.listen(8000, () => (console.log("Funcionando na porta 8000"))) |
Oops, something went wrong.