Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Running The Front and Backend Repos Together

Harry Levine edited this page Jan 2, 2018 · 2 revisions

As the OperationCode site is comprised of a Rails backend repository, and a React frontend repository, there will be times when you will want to run them in concert with one another.

For example, let's say that you are trying to debug an issue you are working on, where clicking something in the UI triggers an endpoint in the backend. Here are the steps to do so.

Run Both Repos Together With Debugging

  • In one tab, have the backend repo open
  • In another, have the frontend repo
  • In the backend tab, anywhere you would have placed a byebug, instead add a Rails.logger.info statement. Like this:
Rails.logger.info "************ got to the create action"
Rails.logger.info "************ current_user = #{current_user.inspect}"

I use all the **** so it is easier to find/search the console for the output.

  • Make sure you have docker running
  • Start the backend repo with make run
  • In the frontend repo tab:
    • run yarn
    • then run yarn start (You will not be running yarn run backend)
  • You should see the output in the backend tab
  • If you add/change any of the logger statements, you might have to restart the backend server

If you want to play around in the rails console, you’ll open up a second backend repo tab, and run make console.