Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jabis Sev贸n
/
esm
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d30faec1
authored
2016-08-17 14:25:43 +0200
by
Rafal Wilinski
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix constant port
1 parent
af7c56fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
index.html
index.js
package.json
index.html
View file @
d30faec
...
...
@@ -136,7 +136,7 @@
Chart
.
defaults
.
global
.
elements
.
line
.
borderColor
=
"rgba(0,0,0,0.9)"
;
Chart
.
defaults
.
global
.
elements
.
line
.
borderWidth
=
2
;
var
socket
=
io
(
'http://'
+
window
.
location
.
hostname
+
':
41338
'
);
var
socket
=
io
(
'http://'
+
window
.
location
.
hostname
+
':
{{port}}
'
);
var
defaultSpan
=
0
;
var
spans
=
[];
...
...
index.js
View file @
d30faec
(
function
()
{
'use strict'
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
os
=
require
(
'os'
);
const
onHeaders
=
require
(
'on-headers'
);
...
...
@@ -81,6 +82,16 @@
const
io
=
require
(
'socket.io'
)(
config
.
socketPort
);
fs
.
readFile
(
path
.
join
(
__dirname
,
'index.html'
),
'utf8'
,
(
err
,
data
)
=>
{
if
(
err
)
throw
new
Error
(
err
);
var
result
=
data
.
replace
(
/{{port}}/g
,
config
.
socketPort
);
fs
.
writeFile
(
path
.
join
(
__dirname
,
'index.rendered.html'
),
result
,
'utf8'
,
(
err
)
=>
{
if
(
err
)
throw
new
Error
(
err
);
});
});
io
.
on
(
'connection'
,
(
socket
)
=>
{
socket
.
emit
(
'start'
,
config
.
spans
);
...
...
@@ -96,7 +107,7 @@
return
(
req
,
res
,
next
)
=>
{
const
startTime
=
process
.
hrtime
();
if
(
req
.
path
===
config
.
path
)
{
res
.
sendFile
(
path
.
join
(
__dirname
+
'/index.html'
));
res
.
sendFile
(
path
.
join
(
__dirname
+
'/index.
rendered.
html'
));
}
else
{
onHeaders
(
res
,
()
=>
{
const
diff
=
process
.
hrtime
(
startTime
);
...
...
package.json
View file @
d30faec
{
"name"
:
"express-status-monitor"
,
"version"
:
"0.0.
5
"
,
"version"
:
"0.0.
6
"
,
"description"
:
"Monitoring for Express-based Node applications"
,
"main"
:
"app.js"
,
"keywords"
:
[
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment