opensource-ny / OpenSource-NY

MIT License
10 stars 14 forks source link

Fetch calls for pull request and commits #72

Closed guti21js closed 5 years ago

guti21js commented 5 years ago

I finally figured out how to do some api calls. I added a backend response for pullrequests and commits. I even gave an example on how to fetch the commits in the bottom of the prdisplay page.

guti21js commented 5 years ago

Also I had to do the fetch with POST as I couldn't do the GET call to work . Somehow the way the backentd was done does not let me access "req.params.name" when creating a route for 'pullrequest/:name' . @Undid-Iridium if you could help me with that it would be great.

Undid-Iridium commented 5 years ago

Firstly I'll check more specifically later; however: req.params contains route parameters (in the path portion of the URL), and req.query contains the URL query parameters (after the ? in the URL). Check line 98 for an example of how to do a get request. Post does not have functionality by default to do what you are suggesting. It isn't impossible but get requests usually take params or query based on the structure of the url request versus post requests that handle through headers/parameters you provide.

Post usually implies adding data versus get implies grabbing data.

I'll generally check what you're trying to do; however, more specific explanation of what you want to do would be helpful.

It'll be faster to message me on slack; however, communication here is fine too.

guti21js commented 5 years ago

I did try it with params. I made a app.get("/pullrequests:name".,....) and then i tried calling req.params.name in the module.exports and it did not work. I know post is not the best and i know post uses header swhile get doesn't . I just don't know how to implement that in your code is all.

yizongk commented 5 years ago

Before anything!!! Let's fix your history first. Its still trakcing alot of files from node_modules

guti21js commented 5 years ago

@yizong let me fix that. Thanks

yizongk commented 5 years ago

No you have to git reset soft to a old commit before that line was touched. Re-add the newer files, then push to hunter college fork --force. As of right now, your history still tracks a LARGE amount of nodel module file. Let me know if you need help donig it.

yizongk commented 5 years ago

@Gutierrezjdr Let us know when this PR is ready to be reviewed again

guti21js commented 5 years ago

@yizongk We pulled this in the hunter fork so it is no longer necessary