-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
52 lines (35 loc) · 1.09 KB
/
server.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const express=require('express');
const app =express();
app.use(express.static('public'));
const port=process.env.PORT || 5000;
app.listen(port,function(){
console.log("Listening at port 5000!");
});
app.get('/',function(req,res){
res.sendFile('index.html')
})
/*var http = require('http');
var url = require('url');
var fs = require('fs');
var uc = require('upper-case');
var port=process.env.PORT || 5000;
http.createServer(function(req,res){
var q =url.parse(req.url,true);
var filename1="." + q.pathname;
var filename="index.html"
if(filename1=="./impressum.html"){
filename=filename1;
}
fs.readFile(filename,function(err,data){
if(err){
res.writeHead(404,{'Content-Type' : 'text/html'});
return res.end("404 Not Found");
}
res.writeHead(200,{'Content-Type' : 'text/html'});
res.write(data);
//res.write(uc.upperCase("Hello Carelle"));
return res.end();
});
}).listen(port);
console.log("Hi carelle");
*/