Realtime Comment Box with React and Laravel
How to run:
- download zip
- extract
- create database (default is: "learn_react" with username: root, and no password; but you can change in .env file)
- run "php artisan migrate --seed" from inside the "react" directory
- run "php artisan serve" (still from inside the "react" directory)
- open browser, and head to http://localhost:8000/test.html
The React part is inside the public folder
- test.html is the HTML file for the application
- application.js is the React application source code
The Laravel Part
- There are two routing at the very bottom of the app/Http/routes.php file. One is for retrieving comments from database (the "get" one), and the other is for saving new comment to the database (the "post" one)
- The CommentController is handling the get and post for retrieving (index method) and saving (store method)