1.0.15 • Published 3 years ago

create-express-mvt v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Create-Express-MVT

This is a boiler-plate creator for expressJS in an MVT format. Each Router-domain has its own Model,View & Routes.

Pros:

  • As each Router Domain has its own work-folder, the domains can be re-used in other products by simply picking and droping into new project files.

npm.io So Basically if I have a project1 and have 3 app/router-domains in it(as displayed in the image above). I also have another project, Project2 which rquires app1 in it.

npm.io

It would be very easy, as all the domains work independently and are coded independently, I would simply copy it to project2 and register it in router.JS

npm.io

npm.io

Installation

npm install -g create-express-mvt

Then go to the folder you want to create your express app

npx create-express-mvt

Create .env file

Define

DB_HOST=`Your MongoDB cluster link without enverted commas`
PORT=`PORT Number without inverted commas`

Creating new apps/router-domains

Only use it from inside the CEM project-workspace

npx create-express-mvt startapp

Now add the app_name to app_register.json in

{"app_name":"router-domain you want it on"}

How it works

The index.js is the main file. It controls the basic defintions and middlewares,etc. Each router-domain known as an App has its own model,view and routes.

What happens in an App:

  • The model is created in model.js
  • The model is then imported to views.js, where views/functions are coded using the imported data-models. Each function which is to be called upon a route is imported independently using module.exports.FUNCTION_NAME=FUNCTION_NAME
  • Then the views are imported in route.js and are connected to needed routes. The router is then exported.
  • The main.js in the app imports routes which is then exported to Global routes.js. The routes.js routes all the routes registered in its JSON object. See the routes.js for understadning how to import your App.

Tutorial Click Here!

Future/Contribution Issues to be:

  • Admin Panel
  • JWT Auth Default-App
1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.10

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago