-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (46 loc) · 1.08 KB
/
index.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
"use strict";
var express = require('express')
, rp= require('request-promise');
var app = express();
console.log(__dirname);
app.use(express.static(__dirname + '/public'));
app.get('/', function (req, res) {
res.sendFile(__dirname + "/public/index.html", function (err) {
if (err) {
console.log(err);
res.status(404).end();
}
else {
console.log('/');
}
});
});
app.get('/multi', function (req, res) {
//console.log(req);
res.sendFile(__dirname + "/public/multi.html", function (err) {
if (err) {
console.log('fejl: ' + err);
}
else {
console.log('multi.html');
}
});
});
app.get(/.+/, function (req, res) {
//console.log(req);
res.sendFile(__dirname + "/public/app.html", function (err) {
if (err) {
console.log('fejl: ' + err);
}
else {
console.log('app.html');
}
});
});
var port = process.argv[4];
if (!port) port= 3000;
var server = app.listen(port, function () {
var host = server.address().address;
var port = server.address().port;
console.log('URL http://%s:%s', host, port);
});