mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-21 14:19:42 +02:00
Handled query params for aliases (#90)
This commit is contained in:
parent
6ac5c71e26
commit
36c6b89023
1 changed files with 8 additions and 1 deletions
|
@ -12,7 +12,14 @@ const verifyToken = require('./middlewares/token');
|
||||||
*/
|
*/
|
||||||
router.get('*', verifyToken, async (req, res) => {
|
router.get('*', verifyToken, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const alias = await Aliases.get(req.originalUrl.slice(1)); // Cuts first '/' character
|
let url = req.originalUrl.slice(1); // Cuts first '/' character
|
||||||
|
const queryParamsIndex = url.indexOf('?');
|
||||||
|
|
||||||
|
if (queryParamsIndex !== -1) {
|
||||||
|
url = url.slice(0, queryParamsIndex); // Cuts off query params
|
||||||
|
}
|
||||||
|
|
||||||
|
const alias = await Aliases.get(url);
|
||||||
|
|
||||||
switch (alias.type) {
|
switch (alias.type) {
|
||||||
case Alias.types.PAGE: {
|
case Alias.types.PAGE: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue