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
e27ebaa6
authored
2016-08-19 12:07:19 +0200
by
Julien Breux
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add title management
1 parent
fd8ad210
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
index.js
index.js
View file @
e27ebaa
...
...
@@ -9,6 +9,7 @@
let
io
;
const
defaultConfig
=
{
title
:
'Express Status'
,
path
:
'/status'
,
spans
:
[{
interval
:
1
,
...
...
@@ -95,7 +96,12 @@
const
startTime
=
process
.
hrtime
();
if
(
req
.
path
===
config
.
path
)
{
res
.
sendFile
(
path
.
join
(
__dirname
+
'/index.html'
));
fs
.
readFile
(
path
.
join
(
__dirname
+
'/index.html'
),
function
(
err
,
content
)
{
content
=
content
.
toString
().
replace
(
new
RegExp
(
defaultConfig
.
title
,
'g'
),
config
.
title
);
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/html'
});
res
.
write
(
content
);
res
.
end
();
});
}
else
{
onHeaders
(
res
,
()
=>
{
const
diff
=
process
.
hrtime
(
startTime
);
...
...
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