1.0.0 • Published 11 months ago

barakat v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Barakat

Barakat is not a framework. It is a tool that help you to speed up the development of projects build on Express JS

Barakat will build for you a project with specific folder structure. Every folder in this project will be used in defferent parts in this project. So, for instance, if you want to add a new route that will run a HTML page you just need to run a CLI provided by Barakat. This will create a folder under the frontend/dist/ folder.

Quick start

To start building your project you need first to install Barakat by running: npm install Barakat

Then you will use CLI provided by Barakat to build project and to add applications to your project.

Build a project.

To initiate a project run the following command: npx lh init This will create all default folder for you.

The project structure

frontend/dist/apps/ :

This will have all your frontend app files.
	

You should probably wondered waht is an app. Every route that will actualy render a HTML file is calling app. You don't need to build separate route for separate HTML page. Barakat usese folder structure for rendring HTML/CSS/JS file for you. So, as you noticed, every app will have at least thre files: HTML, CSS and JS.

frontend/shared/:

This folder consists of tow subfolders: layouts and partials. Those folders ar used for keeping your
layouts nad partials that will be used with EJS.

routes/:

Here you can add your routes. You can devid routes in several files or just keep them in one file.
Barakat will include those routes in your project automatically.

middlewares/:

Add middlewares for ExpressJS application.

locals/

Here you can JS files that will export functions/variables to be used in your .ejs files.

Add a new app:

To add a new app run the following command: npx lh app <app_name>

This will create a <app_name> folder under frontend/dist/apps folder with all default files.

Run the project

To start the project run: node index

Commands

  1. npx bk g app <app_name> This will create an app template for you
  2. npx bk g mw <middleware_name> This will create an middleware template for you
  3. npx bk g event <event_name> This will create an app even for you
  4. npx bk g local <local_name> This will create an app local for you