dawson-org / dawson-cli

A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)
https://dawson.sh
GNU General Public License v3.0
713 stars 25 forks source link

allow specifying a path with a wildcard (eg: path: '*') #156

Closed faceyspacey closed 7 years ago

faceyspacey commented 7 years ago

I'm trying to figure out how this would best work with React where you have a single endpoint mapped from '*'. It seems that's not possible--so what do you do? Copy the same function for 4-6 different endpoints, e.g:

copy 1 of the function: path: '/{part1}'

copy 2 of the function: path: '/{part1}/{part2}'

copy 3 of the function: path: '/{part1}/{part2}/{part3}'

copy 4 of the function: path: '/{part1}/{part2}/{part3}/{partEtc}'

faceyspacey commented 7 years ago

side note: recommendation: put a react server rendering example on the homepage. it will be good for marketing :) ...and figure out and publicize the ins and outs of react using Dawson to make react developers comfortable with it.

lusentis commented 7 years ago

Thank you very much for your input.

Just to clarify your use case, would you like to use this configuration to implement React SSR?

Wildcards are not currently supported due to API Gateway limitations (& we're not using API Gateway's Proxy feature). I'm leaving this issue open since I'd like to discuss this further and merge an implementation in April.

Any suggestion, example, PR or more details will be really appreciated :)

Thanks for your feedback,

lusentis commented 7 years ago

Tracking in #168, this should already work:

stale[bot] commented 7 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

lusentis commented 7 years ago

168 has been merged.

dawson now has full support for the ANY method and greedy path variables :tada:

Example: 3-wildcard-path Documentation: README

(releasing in v0.28)

faceyspacey commented 7 years ago

Thats awesome. I've been waiting to really dive in with your toolset and make it work with my 2 boilerplates/demos for my 2 React open source product lines:

https://github.com/faceyspacey/universal-demo https://github.com/faceyspacey/redux-first-router-demo

More importantly though, I gave you a shoutout in my SurviveJS interview that just went out a few hours ago:

https://www.reddit.com/r/reactjs/comments/6scchf/reduxfirst_router_just_dispatch_actions_interview/

Can't wait to immerse myself in dawson!

lusentis commented 7 years ago

Thank you very much James!

I'll be more than happy to hear your feedback and help with any issue you may experience with dawson. Please also share anything that it's missing, unclear, needs better documentation, or does not work as expected (just remember to npm install -g @dawson/dawson-cli with the scoped package name).

Thank you for the SurviveJS intro too, I'll complete the interview in the coming days :-)

Have a great day, Simone