iraja-baltezan / ibj-wdp-211222-codeigniter_reactjs

CodeIgniter 4 and React JS on shared host.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ibj-wdp-211222-codeigniter_reactjs

CodeIgniter 4 RESTful API and React JS on shared host.

This is a rudimentary code experiment on how to:

  • use CodeIgniter 4 with shared hosting, like a WordPress installation;
  • provide an RESTful API with JWT authentication;
  • and a React front end to authenticate the user and consume that API.

Warning

The "doc" folder contains a copy of the CodeIgniter and Devilbox ".env" files, where the characteristics of the project environment can be consulted.

  • The "devilbox.env" is the .env file in the root of Devilbox's git directory.
  • The "codeigniter.env" is the .env file in the CodeIgniter's "backend" directory.

The .env files were included in the Git commits for educational purposes.

It is advisable to add the ".env" files to the ".gitignore" of the project. Obviously .env files should not be committed if they contain information that compromises the safety of the project.

Some info: Please don't commit .env (https://dev.to/somedood/please-dont-commit-env-3o9h).

Notes

  • The code has been changed to be compatible with react-router-dom v6.
  • The "backend" folder contains the CodeIgniter files.
  • The files from CodeIgniter's "public" folder have been moved to the root of the application, outside of the "backend" folder.
  • The "frontend" folder contains the source code files of front-end app (and does not need to be sent for the hosting server). This source code is packed to /public/dist/ folder.
  • The "public" folder at the root is a suggestion of where the front-end assets might reside.
  • ".htaccess" files apply some access restrictions to the contents of the "frontend" and "backend" folders.

Credits

Inspired by OLUYEMI OLUSUSI's tutorials:

About

CodeIgniter 4 and React JS on shared host.


Languages

Language:PHP 77.8%Language:JavaScript 19.8%Language:CSS 1.8%Language:Hack 0.3%Language:HTML 0.2%