The r-react-demo
app demonstrates how to create a React application that uses R to process data server side. This is a fairly simple example, but it should provide a good starting point for your project. The app was built using the following tools.
Make sure Node and NPM are installed on your machine. You may also use Yarn. To test the installation or to see if these tools are already installed on your machine, run the following commands in the terminal.
node -v
npm -v
git clone https://github.com/davidruvolo51/r-react-demo
Next, install the npm packages that are required to run the app locally. I have decided to use pnpm to manage packages on my machine and across projects. To install pnpm
, run the following command.
npm install -g pnpm
You will need to install the dependencies in the root directory and in the client/
directory.
pnpm install
cd client
pnpm install
If you prefer to use npm
, use the following.
npm install
cd client
npm install
When everything is install, navigate back to the main directory and start the development server. This will start the client at port localhost:8000
and the API at localhost:5000
.
npm run dev
This application was built by piecing together a few blog posts. If you would like to start from scratch, checkout out the How to create a React frontend and a Node/Express backend and connect them post.