Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to split routes into multiple paths and subpaths? #7

Open
tstibbs opened this issue Feb 2, 2021 · 0 comments
Open

How to split routes into multiple paths and subpaths? #7

tstibbs opened this issue Feb 2, 2021 · 0 comments

Comments

@tstibbs
Copy link

tstibbs commented Feb 2, 2021

My routes currently look something like this:

{
	'abcLogin': handleAbcLogin,
	'abcLogout': handleAbcVerify,
	'abcDoAction': handleAbcDoAction,
	'xyzLogin': handleXyzLogin,
	'xyzLogout': handleXyzVerify,
	'xyzDoAction': handleXyzDoAction
}

but I'd like the paths to look like this:

{
	'abc/Login': handleAbcLogin,
	'abc/Logout': handleAbcVerify,
	'abc/DoAction': handleAbcDoAction,
	'xyz/Login': handleXyzLogin,
	'xyz/Logout': handleXyzVerify,
	'xyz/DoAction': handleXyzDoAction
}

Adding a slash into the path doesn't appear to work. I also considered trying to created multiple modofun routers so I could have a master router with just routes for abc and xyz and then have 'sub' routers for each of the three routes within abc and xyz. However, afaics that's not going to work because modofun expects the incoming thing to look like a request from AWS etc.

Is there any other way of achieving this?

(this is a really useful library btw, I've used it in loads of serverless projects over the years, thank you!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant