-
-
Notifications
You must be signed in to change notification settings - Fork 27
Update /resources endpoints to consume from Django API localhost:8000 #102
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
Conversation
@lpatmo - are we expecting local development for frontend to be using the API as well now? If so, (doesn't have to be part of this PR), but we should have a discussion on how to properly test this integration then. |
@angelocordon Yes, we are! The local API is running in development at the same moment. :) I just realized we should have this documented in the README... and I might just record a quick video on Twitch stream to demonstrate the setup right now, so one moment on that! |
Please let me know if there are questions I didn't answer in https://www.youtube.com/watch?v=t43vYwxzG-E&t=210s -- happy to re-record (or answer the questions)! |
Also, I just reread your comment and realized you made a point about properly testing this 😅-- I wrote tests for the backend (codebuddies/backend#128) already so I know that the API requests are covered! Are you saying we should add some integration tests on the frontend too to cover a user being able to see resources when they load the page? |
We should have a discussion on how we should properly set up integration tests but I don't think that would fit in this PR. Maybe we can start a discussion in Slack and once we figure out a strategy we can create an issue. But in the meantime, I see that we don't have any tests for ResourceCard or ResourcePage :) |
Yeah, ideally I think this should be testing that on the I can try adding that test in this PR, or create a new issue for it. The next thing I was going to work on was the front-end implementation of creating a resource, which also needs its own test. :) |
I think a low hanging fruit here would be to test what the ResourceCard should be rendering. We also should/could (?) mock out that GET request to test out the ResourcePage. |
068df0b
to
b05bd32
Compare
@lpatmo @angelocordon What do you think if we deploy one instance of backend server as a staging server? So whoever is working on frontend can connect to backend staging server from localhost without setting up backend locally. |
@gauravchl I think it might be more worth looking for a local mocked server. Ideally, we wouldn't need to connect to an outside network while developing and testing locally. We should have a staging server though but for a different reason. For example: It might work if we can get the latest collection from the backend API and have a mock server using that collection instead of needing to build a Docker instance of the API locally. |
@gauravchl Are you thinking of something like:
Does this also mean we need to make our Side question -- did either of you run into any trouble running the docker command in https://github.com/codebuddies/backend? Just curious! |
@angelocordon Postman mocking server looks interesting! Didn't know before.
@lpatmo Yup
@lpatmo Actually I'm having trouble getting good internet here so I didn't try to setup backend to pull docker images :) |
Oof, I'm sorry -- didn't realize docker would consume a lot of bandwidth. I'll prioritize deploying a staging API, unless something like https://learning.postman.com/docs/postman/mock-servers/setting-up-mock/ is easier. (Never done it before, but I vaguely remember watching Bill do it at one point with dockerhub so I should be able to figure it out, right? :P) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
…host:8000 API instead of the db.json localhost:3001 endpoint (which is outdated)
…s/backend#128 is implemented and merged
At the time of writing, CRA uses Jest 24 and React Testing Library. This adds the latest version of Jest for us to use instead of using react-scripts. Update Github workflow to use Jest instead of react-script. Add Babel Runtime and Transform Runtime Plugin to handle async calls in our tests.
What type of PR is this? (check all applicable)
Description
Updated the /resources listing and single resource page to consume from a locally running Django API app (localhost:8000) at github.com/codebuddies/backend
Related Tickets & Documents
Right now we need to pass in an authorization bearer token in order to see a listing of resources, but we should make that public. Only "create" should be protected. See: codebuddies/backend#128
Before & After
Before: localhost:3001 (db.json)
After: localhost:8000 (github.com/codebuddies/backend)