Skip to content

Commit 689a91c

Browse files
committed
trips route better
1 parent 9503059 commit 689a91c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const express = require('express')
22
const app = express()
33
const path = require('path')
4+
const router = express.Router()
45

56
// Serve static files
67
app.use('/trip-dist', express.static(path.resolve(__dirname, 'dist')))

pages/trip/+Page.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "../main.styl";
88
import "@macrostrat/style-system";
99
import { SETTINGS } from "@macrostrat-web/settings";
1010
import { DarkModeButton } from "@macrostrat/ui-components";
11-
import "./main.sass"
11+
import "./main.sass";
1212

1313
export function Page() {
1414
const pageContext = usePageContext();

server/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ async function startServer() {
9595
process.env.VITE_MACROSTRAT_INSTANCE
9696
);
9797

98+
// Redirect from /test/:id to /test with query parameter
99+
app.get("/trip/:trip", (req, res) => {
100+
const { trip } = req.params;
101+
// Redirect to /test with query parameter `id`
102+
res.redirect(`/trip?trip=${trip}`);
103+
});
104+
98105
/**
99106
* Vike route
100107
*

0 commit comments

Comments
 (0)