This script automates the creation of a new folder with predefined files for your RCQ (Route-Controller-Query) structure in a Node.js project.
- Creates a new folder within the
src/RCQ
directory - Generates three files:
Query.js
,Controller.js
, andRouter.js
- Automatically populates these files with boilerplate code
- Ensures the
src/RCQ
parent directory exists
- Node.js installed on your system
- Access to the command line
- Clone this repository or download the script file.
git clone https://github.com/ibrataha8/rcq-folder-factory
- Navigate to the directory containing the script.
cd rcq-folder-factory
- Install Dependencies:
npm install
- Install the package globally:
npm i -g rcq-folder-factory
- Create a new RCQ folder:
npx rcq-folder-factory --namefolder=NewFolder
- Result
The script will create the following structure:
src/
└── RCQ/
└── NewFolder/
├── Query.js
├── Controller.js
└── Router.js
- Query.js
- Contains a basic query to select all items from a table named after your folder.
- Controller.js
- Sets up a controller function to handle GET requests for all items.
- Router.js
- Configures an Express router with a GET route for the new resource.
- You can modify the script to change the content of the generated files or add more files as needed.
- Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.
- For any questions or feedback, please contact ibrataha8@gmail.com.