-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
66 lines (46 loc) · 1.58 KB
/
app.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var express = require('express');
var path = require('path');
var app = express();
//Without static path
// app.get('', function (req, res) {
// //let absPath=path.join(__dirname,"index.html");
// //res.sendFile(absPath);
// res.sendFile("index.html",{"root":__dirname});
// })
// app.get('/about', function (req, res) {
// // let absPath= `path.join(__dirname,"about.html");
// // res.sendFile(absPath);
// res.sendFile("about.html",{"root":__dirname});
// })
// app.get('/services', function (req, res) {
// // let absPath=path.join(__dirname,"services.html");
// // res.sendFile(absPath);
// res.sendFile("services.html",{"root":__dirname});
// })
// app.listen(3000, function () {
// console.log('Example app listening on port 3000!')
// })
// let express = require("express");
// let app = express();
var express = require("express");
var app = express();
// app.get('/', function(req, res) {
// res.send('Hello World!');
// //res.sendFile("index.html",{"root":__dirname});
// });
app.use(express.static(path.join(__dirname,"public")));
var port = Number(process.env.PORT || 5000);
app.listen(port, function() {
console.log("Listening on " + port);
});
// const http = require('http');
// const hostname = '127.0.0.1';
// const port = 3000;
// const server = http.createServer((req, res) => {
// res.statusCode = 200;
// res.setHeader('Content-Type', 'text/plain');
// res.end('Hello World\n');
// });
// server.listen(port, hostname, () => {
// console.log(`Server running at http://${hostname}:${port}/`);
// });