-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnectAlpha.js
More file actions
39 lines (33 loc) · 794 Bytes
/
connectAlpha.js
File metadata and controls
39 lines (33 loc) · 794 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
32
33
34
35
36
37
38
39
"use strict";
var http = require('http');
var fs = require('fs');
var qs = require('querystring');
var connect = require('connect');
var app = connect();
var serveStatic = require('serve-static');
var server = http.createServer(app);
var keyIn ;
app.use(function middleWare1(req, res, next) {
function myInput(file, code, option, next) {
fs.readFile(file, {
encoding: "utf8"
}, function(err, data) {
res.writeHead(code, {
'Content-Type': option
});
if (err) throw err;
res.write(data);
if (next) {
next(function(err) {
if (err) throw err;
});
} else {
res.end();
}
});
};
next();
});
app.use(serveStatic("public", {'index': ['panels.html']}));
server.listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');