|
|
@ -1,5 +1,20 @@ |
|
|
|
var express = require('express'); |
|
|
|
var path = require('path'); |
|
|
|
var serveStatic = require('serve-static');app = express(); |
|
|
|
app.use(serveStatic(__dirname));var port = process.env.PORT || 5000; |
|
|
|
app.listen(port);console.log('server started '+ port); |
|
|
|
const http = require('http') |
|
|
|
const fs = require('fs') |
|
|
|
const httpPort = 80 |
|
|
|
|
|
|
|
http.createServer((req, res) => { |
|
|
|
fs.readFile('index.html', 'utf-8', (err, content) => { |
|
|
|
if (err) { |
|
|
|
console.log('We cannot open "index.html" file.') |
|
|
|
} |
|
|
|
|
|
|
|
res.writeHead(200, { |
|
|
|
'Content-Type': 'text/html; charset=utf-8' |
|
|
|
}) |
|
|
|
|
|
|
|
res.end(content) |
|
|
|
}) |
|
|
|
}).listen(httpPort, () => { |
|
|
|
console.log('Server listening on: http://localhost:%s', httpPort) |
|
|
|
}) |
|
|
|
|