Skip to content

Enhanced support for batch endpoints #3042

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

Merged
merged 2 commits into from
Nov 25, 2016
Merged

Enhanced support for batch endpoints #3042

merged 2 commits into from
Nov 25, 2016

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Nov 12, 2016

Adds ability to have publicServerURL different from serverURL ex: http://api.my-parse.com/ and http://localhost/parse for batch calls

Fixes #2980

@flovilmart flovilmart changed the title Allow to have different endpoint on publicserverURL and serverURL whe… Enhanced support for batch endpoints Nov 12, 2016
@facebook-github-bot
Copy link

@flovilmart updated the pull request - view changes

Copy link
Contributor

@steven-supersolid steven-supersolid left a comment

Choose a reason for hiding this comment

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

Just a couple of nits

}

function mBatchRoutingPath(originalUrl, serverURL, publicServerURL) {
serverURL = serverURL ? parseURL(serverURL) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

minor but could you just move the check for URL being defined into parseURL? e.g. change in the function to if (URL && typeof URL === 'string') {

return undefined;
}

function mBatchRoutingPath(originalUrl, serverURL, publicServerURL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: is m short for make? Prefer explicit function names for clarity

if (requestPath.slice(0, apiPrefixLength) != apiPrefix) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
'cannot route batch path ' + path);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think path here will point to the require. Should be requestPath?


let makeRoutablePath = function(requestPath) {
// The routablePath is the path minus the api prefix
if (requestPath.slice(0, apiPrefixLength) != apiPrefix) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: could replace apiPrefixLength with apiPrefix.length here and on line 35 and then remove line 44

@facebook-github-bot
Copy link

@flovilmart updated the pull request - view changes

@flovilmart flovilmart merged commit d800ff8 into master Nov 25, 2016
@flovilmart flovilmart deleted the issue-#2980 branch November 25, 2016 01:14
rsouzas pushed a commit to back4app/parse-server that referenced this pull request Dec 3, 2016
* Allow to have different endpoint on publicserverURL and serverURL when batching

* nits
Jcarlosjunior pushed a commit to back4app/parse-server that referenced this pull request Dec 13, 2016
* Allow to have different endpoint on publicserverURL and serverURL when batching

* nits
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.

3 participants