Giter Club home page Giter Club logo

react-on-rails-boilerplate's Introduction

README

Background

This boilerplate uses the most recent release of Rails (as of 04/2019, 5.2.1). It also takes advantage of the Webpacker gem to integrate React (link to gem). As a bonus, the React testing environment is also set up for you, using Jasmine/Enzyme with PhantomJS. To set up this testing environment, I used this gist from my friend (link to gist).

Note that as of 04/2019, I have updated the Gemfile to not contain any version numbers. There were some updates since 2017. Ya know... just some. (Read as: A few hours of figuring out why everything was borked.)

How-to

  • Clone down this repo to your desktop and rename as necessary.
  • Run bundle and npm install to get all the dependencies sorted out.
  • Run rake db:create to set up your database properly. (Be sure to rename all the appropriate stuff in the config files!)
  • Before testing with React, you will need to add the location of your testHelper.js to the karma.conf.js file. To do this, navigate to karma.conf.js and paste the testHelper.js file path into the files array (I've also left a comment and an example there for you). It is also possible that you will need to run karma init. You can answer the questions from the prompt using this gist.
  • When you want to run the servers to see your work locally, run both rails s.
  • When you want to check your React tests, run npm test. (Run rake for Rails/Ruby tests.)

Notes

  • The Webpacker gem comes with its own example that gets set up when you download it. You can read about how to connect the example to your work to troubleshoot the environment.
  • As with any environment, not everything is going to be perfect. Please leave comments or questions for me, and I'd be happy to answer. This is a work in progress, and I'll likely be adding "dummy" components/pages for people to see how Webpacker interacts in a Rails environment.
  • I did not add React Router to this. If this is something you think you'd use, I'd be happy to put this into package.json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.