react-project
react-project copied to clipboard
Wrong args in blueprint's API handler
After https://github.com/ryanflorence/react-project/pull/31, the args for https://github.com/ryanflorence/react-project/blob/master/create-react-project/blueprint/modules/api/hello.js#L1 need to be updated
// now
export default function (req, res, { params, location, route }) {
...
}
// correct
export default function (req, res, lastRoute, { params, location, route }) {
...
}
(In the README as well https://github.com/ryanflorence/react-project/blob/master/README.md#serverroutehandlerreq-res--params-location-route-)
However, the lastRoute
and route
args there are the same. Would it make sense to use props.route
instead of adding a separate arg here in handleServerRoute
?: https://github.com/ryanflorence/react-project/blob/master/modules/PublicServerAPI.js#L143
// now
function handleServerRoute(req, res, route, props) {
const handler = route[req.method.toLowerCase()]
...
}
// perhaps?
function handleServerRoute(req, res, props) {
const handler = props.route[req.method.toLowerCase()]
...
}
(Will gladly open a small PR for either one!)
I think it makes more sense to use the param.route in this case. Fixing the bug the way it was appeared to not hurt anything. Thanks for catching that!
Sorry, testing out ryans-ghn.herokuapp.com gonna close and reopen this thing.
and now reopen