This is my backend application in which I set up an API with Sinatra and Active Record that can support my React frontend, which can be found here:
https://github.com/mitchellht34/phase-3-sinatra-react-project-frontend.git
My goals was to set up my models in which, if I find a comic book character, I can see what series/books they star in. I find the best way to start reading comics is to pick a character you like and read that one through and you may find someone else you like through there. With my models set up in this way, I can show people what comics a certain character was in and will have a list of comics to show and where to start reading.
This repository has all the code I used to get my Sinatra backend up and running. Fork and clone this repository to get started.
Then, run
bundle install
to install the gems.
The app/controllers/application_controller.rb
file has an example GET route
handler just so I can see that the application will actually run something when it first starts up.
You can start your server with:
$ bundle exec rake server
This will run your server on port http://localhost:9292.
-
If you would like to use the backend by itself, by all means, you are welcome to. However, it is recommended to use Postman to test your endpoints and practice making calls to the server.
-
Using
binding.pry
to debug your requests on the server is very helpful. As such, thepry
gem has been included. -
Use the Network Tab in the Dev Tools in the frontend to debug your requests if necessary.