Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
OGC
node-3DPS
Commits
2db63077
Commit
2db63077
authored
3 years ago
by
Athanasios
Browse files
Options
Download
Email Patches
Plain Diff
refactor redirection
parent
300497f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/redirectTo.js
+13
-20
src/redirectTo.js
with
13 additions
and
20 deletions
+13
-20
src/redirectTo.js
+
13
-
20
View file @
2db63077
const
url
=
require
(
'
url
'
);
const
mapper
=
{
getscene
:
"
scene
"
,
getcapabilities
:
"
capabilities
"
};
const
redirectTo
=
(
request
,
req
,
res
)
=>
{
switch
(
request
.
toLowerCase
())
{
case
"
getscene
"
:
{
res
.
redirect
(
url
.
format
({
pathname
:
`
${
req
.
baseUrl
}
/scene`
,
query
:
req
.
query
,
})
);
break
;
}
case
"
getcapabilities
"
:
{
res
.
redirect
(
url
.
format
({
pathname
:
`
${
req
.
baseUrl
}
/capabilities`
,
query
:
req
.
query
,
})
);
break
;
}
}
let
path
=
mapper
[
request
.
toLowerCase
()];
res
.
redirect
(
url
.
format
({
pathname
:
`
${
req
.
baseUrl
}
/
${
path
}
`
,
query
:
req
.
query
,
})
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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