The Druid-Final-Project integrates Drupal as the backend and React.js as the frontend, developed in collaboration with Druid Oy to meet their specific requirements. This project demonstrates a seamless interaction between these technologies, where Drupal handles content management, and React provides a dynamic front-end interface using JSON. The communication between the two platforms is facilitated through JSON:API, with the React app managing all frontend presentation. Additionally, CORS issues between the two were resolved by implementing a services.yml file in the Drupal configuration.
- Drupal 10: For managing and storing the backend content.
- JSON:API: Used for managing API requests between Drupal and the React app.
- Lando: A local development environment for setting up and managing the Drupal project.
- YAML: For configuring the
services.yml
file, solving CORS issues between the frontend and backend.
- React.js: Create a frondend folder for building the frontend UI.
- Node.js & NPM: Required to manage the React environment.
- Axios: For making HTTP requests.
- React Router DOM: For routing within your React application.
- React Bootstrap: For using Bootstrap components in React.
To get started, follow these steps:
git clone https://github.com/bishnu-suyel/Druid-Final-Project
Inside the project folder, run the following command to start Lando:
lando start
Make sure the necessary dependencies are installed:
lando composer install
Run the following command to install the Drupal site and configure the database:
lando drush site:install --db-url=mysql://drupal10:drupal10@database/drupal10 -y
Edit the services.yml file to manage CORS issues between the frontend and backend. Add the following:
services.yml
cors.config:
enabled: true
allowedHeaders: ["*"]
allowedMethods: ["GET", "POST", "OPTIONS", "PATCH", "PUT", "DELETE"]
allowedOrigins: ["*"]
supportsCredentials: true
To enable JSON in Drupal, follow these steps:
lando drush en jsonapi -y
Access the content through the API at a URL like:
http://Druid-Final-Project.lndo.site/jsonapi/node/home
Navigate to the frontend folder and install the necessary dependencies:
npm install
To start the frontend React app, run the following command:
npm run dev
This will launch the React app on http://localhost:5173, fetching data from the Drupal backend. Make sure that the drupal app is up and running.
Not yet available.
Not yet available.
- GitHub Guides - Mastering Markdown
- Make a README
- Drupal JSON Documentation
- Lando Documentation
- React Documentation
This project was developed with contributions from the following individuals:
We as a team appreciate each others efforts and collaboration in making this project a success!