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

Mock bustime server #30

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

its-all-waves
Copy link

@its-all-waves its-all-waves commented Nov 27, 2024

Mock Bustime Server

Address issue #29.

With the addition of a mock server to provide vehicle data, the API key is no longer needed for development, making contributing possible for many more people.

Changes

  • add mock bustime data server
  • use the mock server when in DEV mode (establish DEV mode in main server)
  • update README with new dev instructions
  • rename Config.Url to .BaseUrl as it was causing confusion in Scraper.fetch(), where we compute the complete URL with query params.
  • fix log typo in VehicleBroadcaster.Start()
  • partially address issue Check error before response body #24 - move response error check to before resp.Body nil check in Scraper.fetch()
  • add vscode debugger config for main server (open main.go and run the gui debugger)

Bug

There is a bug, which I imagine affects the production version, as well. Currently, if the mock server is killed, the main server panics. I will make a separate PR for this once this one is accepted. EDIT: This has been fixed in another branch. Awaiting acceptance of this PR.

Future Improvements

It might be cool to have the mock server cycle through several different responses so we can see vehicle movement on the frontend in dev mode. Currently, vehicles appear stationary.

Thanks @vipyne for pairing up with me on this! Thanks @codingMustache for the mock data!

…tions;

add: DEV env var and DEV mode to main.go;
- rename Config.Url to .BaseUrl as it was causing confusion in Scraper.fetch(), where we compute the complete url with params, etc
- use the mock bustime server when in DEV mode in ./main.go
- fix log typo in VehicleBroadcaster.Start()
…e nil repsonse error check to before nil response.Body check
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
…'; remove: log 'Scraper' response; change: run in dev mode with 'make dev' (no more '...DEV=1'; remove: unused vars from Makefile
main.go Show resolved Hide resolved
mock_bustime_server/main.go Outdated Show resolved Hide resolved
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.

2 participants