-
Hey guys. How do I set a rule for a I need in my project to distinguish a public route from a private one, but the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
For v2: For v3@beta: |
Beta Was this translation helpful? Give feedback.
-
just updating if they find this question: you can use You might want to do something like: [Typescript] const createRoute = ({
redirectHost,
route,
useAsPrefix = true,
}: IRouteOptions) => {
const routePath = useAsPrefix ? `${route}/**` : route;
router.use(
`^/oldApi/${routePath}$`,
createProxyMiddleware({
pathRewrite: {
'^/oldApi': '/newApi',
},
target: redirectHost,
}),
);
}; @chimurai thanks for the help |
Beta Was this translation helpful? Give feedback.
just updating if they find this question: you can use
^/user$
as exact path and^/user/**$
to match all routes that have/user
as prefix.You might want to do something like:
[Typescript]
@chimurai thanks for the help