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

getParams from parrot-core should be exposed #208

Closed
smackfu opened this issue Apr 17, 2023 · 0 comments · Fixed by #209
Closed

getParams from parrot-core should be exposed #208

smackfu opened this issue Apr 17, 2023 · 0 comments · Fixed by #209

Comments

@smackfu
Copy link
Member

smackfu commented Apr 17, 2023

Given a somewhat complex matcher like this:

  const getBook = ({ url }, match) => {
    const path = '/books/:bookId';
    if (match({ path, method: 'GET' })) {
      const { bookId } = getParams(url, path);
      const book = books.find((book) => book.bookId === bookId);
      if (!book) {
        return { status: 404 };
      }
      return { status: 200, body: book };
    }
    return null;
  };

The getParams function that is needed is not exposed by parrot, even though it has an implementation.

It would be convenient if that was available for consumers to use.

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

Successfully merging a pull request may close this issue.

1 participant