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

Option for a more express-like routing API #16

Open
danvk opened this issue Apr 8, 2021 · 0 comments
Open

Option for a more express-like routing API #16

danvk opened this issue Apr 8, 2021 · 0 comments

Comments

@danvk
Copy link
Owner

danvk commented Apr 8, 2021

Normally with Express, the router API looks like this:

router.post('/path/:param', (request, response) => {
  const {params, body} = request;
  // ...
});

The crosswalk equivalent looks like:

typedRouter.post('/path/:param', (params, body, request, response) => {
  // ...
});

There's no reason crosswalk couldn't provide an equivalent of the express post that just takes request and response params but types their body & params properties. This might make migration simpler and would remove some awkwardness when you want the request param but don't have path params or a body.

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

No branches or pull requests

1 participant