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

balexandre patch 1684 #1702

Closed
wants to merge 4 commits into from

Conversation

balexandre
Copy link

Took the base code from latest version 6 and applied the version 7 routing.

fixes #1684

Pre-Submission Checklist

  • [✓] Opened an issue discussing these changes before opening the PR
  • [✓] Ran the linter and tests via make prepush
  • [✓] Included comprehensive and convincing tests for changes

Issues

Closes:

Summarize the issues that discussed these changes

bringing back the missing but very useful server.router.render() to version 7

Changes

What does this PR do?

brings back server.router.render()

@stale
Copy link

stale bot commented Nov 10, 2018

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.

@stale stale bot added the Stale label Nov 10, 2018
@balexandre
Copy link
Author

why staling this issue ... it's fixed and works as it should before the new version...
can you guys ( @hekike @DonutEspresso ) spend a min and look at it? :)

@stale stale bot removed the Stale label Nov 11, 2018
@stale
Copy link

stale bot commented Jan 10, 2019

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.

@stale stale bot added the Stale label Jan 10, 2019
@stale
Copy link

stale bot commented Jan 25, 2019

This issue has been automatically closed as stale because it has not had recent activity.

@stale stale bot closed this Jan 25, 2019
@rajatkumar
Copy link
Member

Reopening this PR. @hekike let me know if I can help in anyway here.

@rajatkumar rajatkumar reopened this Feb 8, 2019
@rajatkumar rajatkumar removed the Stale label Feb 8, 2019
* @param {String} routeName - the route name
* @param {Object} params - an object of route params
* @param {Object} query - an object of query params
* @returns {String} URL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add an example here, the new API site would render it to the website.
Like:

@example
server.get( { name: 'cities', path: '/countries/:name/states/:state/cities' }, (req, res, next) => ...);
var cities = server.router.render('cities', {  name: 'Australia', state: 'New South Wales' });
// cities:  '/countries/Australia/states/New%20South%20Wales/cities'

server.router.render('cities', { name: 'Australia' });
} catch (ex) {
t.equal(ex, 'Error: Route <cities> is missing parameter <state>');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should throw if we catch branch doesn't run

@hekike
Copy link
Member

hekike commented Feb 8, 2019

@rajatkumar I added some comments, I'm not sure about @balexandre availability or appetite to address them. Maybe you could help there. I'm fine with merging it first.

@ghermeto
Copy link
Member

fixed on #1752

@ghermeto ghermeto closed this Jul 11, 2020
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 this pull request may close these issues.

Router.render() disappeared in 7, where did it go?
4 participants