Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ITPDP2019
Gain.fam
web-server
Commits
85cfb4f8
Commit
85cfb4f8
authored
May 13, 2019
by
Magnus Holm Brunbjerg
Browse files
ip
parent
c1c26181
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/app/index.js
View file @
85cfb4f8
...
...
@@ -8,6 +8,10 @@ const fetch = require('node-fetch')
const
app
=
express
()
const
port
=
process
.
env
.
PORT
const
apiIp
=
process
.
env
.
API_IP
const
apiPort
=
process
.
env
.
API_PORT
const
apiPath
=
process
.
env
.
API_PATH
app
.
listen
(
port
,
(
err
)
=>
{
if
(
err
)
return
console
.
error
(
err
)
console
.
log
(
`Web server startet på http://
${
require
(
'
ip
'
).
address
()}
:
${
port
}
`
)
...
...
@@ -54,7 +58,7 @@ app.get('/', (req, res, next) => {
// List all experiments
app
.
get
(
'
/experiments
'
,
(
req
,
res
,
next
)
=>
{
fetch
(
`http://
${
process
.
env
.
API_IP
}
:
${
process
.
env
.
API_PORT
}${
process
.
env
.
API_PATH
}
/experiments`
,
{
fetch
(
`http://
${
apiIp
}
:
${
apiPort
}${
apiPath
}
/experiments`
,
{
method
:
'
GET
'
,
mode
:
'
cors
'
,
headers
:
{
...
...
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