mvc-node-express
v1.1.0
Published
MVC framework for express js
Downloads
25
Readme
mvc-node-express
modern node js and express framework in MVC architecture if you are work with php/laravel framework so this is great because you know this framework architecture
install :hammer:
you can do this with 2 ways: 1 - download project from github 2 - download project from gitlab 3 - use NPM i'll explain about installing with npm for that first you must create a folder and run:
npm init
after that some question will asking from your application answer them and after that run :
npm i mvc-node-express
after that if you using Windows please add this line to your package.json in script field
"build":"move node_modules/mvc-node-express ./ && rmdir /s node_modules && Del package-lock.json && Del package.json"
or if you use linux/mac OS add this line:
"build":"mv node_modules/mvc-node-express ./ && rm -r node_modules && rm package-lock.json && rm package.json"
after that you save this and run:
npm run build
if you use windows : one question ask from you and you must type y enter after that you can see mvc-node-express folder insted of your other files enter to that and run:
npm install
for installing dependencies and thats it congratulations :wine_glass: :wine_glass: lets look at this framework architecture
|---app | |---Controllers | | |---Auth | |---Middleware | | |---Auth | |---Models | | |---public | |---css | |---fonts | |---images | |---img | |---js | |---scss | |---vendor | | |---routes | | |---views | | |---.gitignore | |---package-lock.json | |---package.json | |---server.js
app
this folder conatins 3 subfolders:
Controllers
this folder is used to place any Controller you want in your application this folder has a subfolder with Auth name that contains Controllers used in register/login
Middleware
this folder is used to place any Middleware you want in your application this folder has a subfolder with Auth name that contains Middleware used in register/login
Models
this folder is used to place any Models you want in your application by default we put User Model in it that used for Auth system
public
this folder is a place to hold static files like css,js,images,... every static file you need put in your project you must put it in this folder
routes
this folder contain some files [router.js, requests.js, api.js]
router.js
this file contain any route in your application Auth routes added by Default validation filters are comming in this file with an array but catching errors
requests.js
this file contain a class that has some methods for sending api request to another server this class added in both router and api files you can use it by typing Request
api.js
this file contains any route for send data with api for another platforms passing to Middleware
views
this folder contains any view file that used in your project default engine of this framework is PUG engine
server
server.js file contains codes that you need to start your server the default port after start the application is 800 you can start your server in developer mode with:
npm run dev
or you can run application in production mode by:
npm run production
after that you can see your application in:
http://localhost:800
github
github page : mvc-node-express
gitlab
gitlab page : mvc-node-express
NPM
NPM page : mvc-node-express