-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservidor.js
More file actions
31 lines (28 loc) · 812 Bytes
/
servidor.js
File metadata and controls
31 lines (28 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const http = require('http')
const fs = require('fs')
const host = '127.0.0.1'
const puerto = 9000
const servidor = http.createServer((req, res) => {
res.writeHead(200, {'content-Type': 'text/html'})
fs.readFile('./dist/web3.html', (error, información) =>{
if(error){
res.writeHead(404)
res.write("archivo no encontrado")
} else {
res.write(información)
}
res.end()
})
fs.readFile('./src/web3.js', (error, información) =>{
if(error){
res.writeHead(404)
res.write("archivo no encontrado")
} else {
res.write(información)
}
res.end()
})
})
servidor.listen(puerto, host, () =>{
console.log('Servidor esta funcionando en ', host, puerto)
})