Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Johan Jatko
nodejs-api-demo-plz-nooo
Commits
ad8ffd78
Commit
ad8ffd78
authored
Nov 08, 2020
by
Johan Jatko
Browse files
Update index.html, server.js files
parent
e2019897
Changes
2
Hide whitespace changes
Inline
Side-by-side
index.html
0 → 100644
View file @
ad8ffd78
<!DOCTYPE html>
<html>
<head>
<title>
Super demo cool stuff
</title>
</head>
<body>
<h1>
This is my awesome app
</h1>
<h2>
Latest api request was serverd from
<span
id=
"server"
>
NOTHING
</span></h2>
</body>
<script>
setTimeout
(
function
()
{
fetch
(
"
/api/gimmesome
"
).
then
(
function
(
response
)
{
server
=
document
.
querySelector
(
"
#server
"
);
server
.
innerHTML
=
response
;
});
},
2000
);
</script>
</html>
\ No newline at end of file
server.js
0 → 100644
View file @
ad8ffd78
var
http
=
require
(
'
http
'
);
var
os
=
require
(
"
os
"
);
var
hostname
=
os
.
hostname
();
http
.
createServer
(
function
(
req
,
res
)
{
res
.
write
(
hostname
);
res
.
end
();
}).
listen
(
5000
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment