malipk-test 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of malipk-test might be problematic. Click here for more details.
- package/bin/www +93 -0
- package/dist/bundle.js +7842 -0
- package/package.json +64 -0
package/bin/www
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
/**
|
2
|
+
* Module dependencies.
|
3
|
+
*/
|
4
|
+
let config = require('../config');
|
5
|
+
const { path } = require('../app');
|
6
|
+
var app = require('../app');
|
7
|
+
var debug = require('debug')('plateau-designer-provider:server');
|
8
|
+
var server = require('http').Server(app);
|
9
|
+
var http = require('http');
|
10
|
+
require('../db/index');
|
11
|
+
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Get port from environment and store in Express.
|
15
|
+
*/
|
16
|
+
var port = normalizePort(process.env.PORT || '3000');
|
17
|
+
app.set('port', port);
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Web socket
|
22
|
+
*/
|
23
|
+
require('../ws/index').wsInit(server);
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Listen on provided port, on all network interfaces.
|
29
|
+
*/
|
30
|
+
server.listen(port);
|
31
|
+
server.on('error', onError);
|
32
|
+
server.on('listening', onListening);
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Normalize a port into a number, string, or false.
|
36
|
+
*/
|
37
|
+
|
38
|
+
function normalizePort(val) {
|
39
|
+
var port = parseInt(val, 10);
|
40
|
+
|
41
|
+
if (isNaN(port)) {
|
42
|
+
// named pipe
|
43
|
+
return val;
|
44
|
+
}
|
45
|
+
|
46
|
+
if (port >= 0) {
|
47
|
+
// port number
|
48
|
+
return port;
|
49
|
+
}
|
50
|
+
|
51
|
+
return false;
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Event listener for HTTP server "error" event.
|
56
|
+
*/
|
57
|
+
|
58
|
+
function onError(error) {
|
59
|
+
if (error.syscall !== 'listen') {
|
60
|
+
throw error;
|
61
|
+
}
|
62
|
+
|
63
|
+
var bind = typeof port === 'string'
|
64
|
+
? 'Pipe ' + port
|
65
|
+
: 'Port ' + port;
|
66
|
+
|
67
|
+
// handle specific listen errors with friendly messages
|
68
|
+
switch (error.code) {
|
69
|
+
case 'EACCES':
|
70
|
+
console.error(bind + ' requires elevated privileges');
|
71
|
+
process.exit(1);
|
72
|
+
break;
|
73
|
+
case 'EADDRINUSE':
|
74
|
+
console.error(bind + ' is already in use');
|
75
|
+
process.exit(1);
|
76
|
+
break;
|
77
|
+
default:
|
78
|
+
throw error;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Event listener for HTTP server "listening" event.
|
84
|
+
*/
|
85
|
+
|
86
|
+
function onListening() {
|
87
|
+
var addr = server.address();
|
88
|
+
var bind = typeof addr === 'string'
|
89
|
+
? 'pipe ' + addr
|
90
|
+
: 'port ' + addr.port;
|
91
|
+
debug('Listening on ' + bind);
|
92
|
+
}
|
93
|
+
|